製作遊戲第一步當然就是要學程式囉

遊戲中一定會使用的變數

int float string bool 記得要多練習基本用法

public class Test : MonoBehaviour {

    int i;
    float f;
    string s;
    bool b;
    void Start ()
    {
        i = 100 * 2;
        f = 0.5f / 2;
        s = "Unity真好玩" + "YA" + (i + f);
        b = true;

        Debug.Log(i);
        Debug.Log(f);
        Debug.Log(s);
        Debug.Log(b);
    }
}

另外補充

i = 100 是直接等於100

如果要做計算

i += 100;  或是 i = i + 100;

https://youtu.be/opAmCR-Ne3s

arrow
arrow

    Weight 發表在 痞客邦 留言(0) 人氣()