都可以改变外部变量的值
void jiafa(int a, int b, ref int c)
{
c = a + b;
}
// Start is called before the first frame update
void Start()
{
//ref修饰的必须在外面赋值
int res=0;
jiafa(1, 2,ref res);
print(res);
}
void jiafa(int a, int b, out int c)
{
c = a + b;
}
// Start is called before the first frame update
void Start()
{
//out修饰的不用在外面赋值
int res;
jiafa(1, 2, out res);
print(res);
}
111