2017-03-29

Unity Tips

來源網址



1. PlayMode時改變Color


























[Editor]->[Preference時可以開啟]此視窗,在Color區塊可以修改Playmode tint的大小

2. 在Unity的Scene中,按下Ctrl在移動物件的位置時可以變成固定移動多少,而不是平滑的移動。預設固定移動多少的數值可以在[Editor]->[Snap Settings]中設定










3.鎖住Inspector
假如你想要選擇某個GameObject,又不想改變目前Inspector顯示的內容,就可以點選綠色圈起來的部分。使用它來固定/解除鎖定目前選到的Inspector













4. Debug Mode
在Debug mode下可以看到private的變數


















6. Range







在Script中,在要調整的變數上面加上RangeAttribute屬性,就可以限制該變數可以調整的最大最小值。

7. 假設在Play模式下調好Comp的內容,如何複製/貼上Component的數值。

















在Component的右側按下右鍵,可以看到右側的畫面,Copy Component = 複製目前Component的相關數值, Paste Component Value = 貼上複製好的Componet的數值

8. Space & Header

Header Attribute : 可以在Inspector顯示Header的內容(畫綠線的部分)



9/ Hide In Inspector
在要不顯示給Inspector的Public變數加上 [HideInInspector]屬性,就不會顯示在Inspector中

10. [SerializeField]
可以把Private的變數顯示在Inspector中

沒有留言: