c# 语法

一、对于引用类型你了解多少?

   string a = "1";
   string b = a;
   a = "2";
   print(b);
  
   GameObject a = new GameObject("1");//game object 有一个 name 构造
   GameObject b = a;
   a.name = "2";
   print(b.name);
 
   Vector2 a = new Vector2(1, 1);
   Vector2 b = a;
   a.x = 2;
   print(b.x);
 
   GameObject a = new GameObject("1");
   GameObject b = a;
   a = new GameObject("2");
   print(b.name);
  

 二、Float 转为 Int 类型

    void Awake()
    {
        float a = 3.8f;
        float b = 3.8f;
        int x, y;
        float tmp;
        tmp = (a * 100);
        x = (int)tmp;
        y = (int)(b * 100);
        Debug.Log("x:" + x);
        Debug.Log("y:" + y);
    }

原文地址:https://www.cnblogs.com/chongxin/p/3975635.html