標籤:style blog http java color 2014
聖典中對於Unity3D的序列化介紹很容易和C#的序列化介紹搞混,做個筆記,方便以後尋找。
很多資料算是拾人牙慧.
一、Serializable 序列化
Inherits from Attribute
The Serializable attribute lets you embed a class with sub properties in the inspector.
Serializable(序列化)屬性讓你植入一個類用替代內容在Inspector(檢視面板)
You can use this to display variables in the inspector similar to how a Vector3 shows up in the inspector. The name and a triangle to expand its properties. To do this you need create a class that derives from System.Object and give it the Serializable attribute. In JavaScript the Serializable attribute is implicit and not necessary.
你可以用這個去顯示變數在inspector(檢視面板)類似於將一個Vector3(3維向量)顯示在inspector(檢視面板)。這個名字和一個三角來擴充他的內容。去做這個你需要建立一個起源於System.Object的類並且給他Serializable屬性。在JavaScript這個Serializable屬性是隱含的,不必要的。
class Test extends System.Object {var p = 5;var c = Color.white;}var test = Test ();
// C# Example[System.Serializable]class Test{public int p = 5;public Color c = Color.white;}
You Can Do Like that: 本質上不過就是用一個類來代替一些欄位讓編輯器編輯罷了 未完待續……