public class GraphData : ScriptableObject
{
public string Title;
[HideInInspector]
public string hide;
private int pri;
public Type tt;
public int[] array;
[ContextMenu("set")]
public void testSet()
{
tt = this.GetType();
hide = "h" + pri;
pri++;
//UnityEditor.EditorUtility.SetDirty(this);//没发现影响
}
[ContextMenu("print")]
public void test()
{
Debug.Log(tt+" test: " + hide + ";" + pri);
}
}
示例代码如上:
1.部分类型不支持持久化保存,即关闭Unity编辑器后再打开就没了,如:Type可能就不行,但需要再测试,留坑;
*坑:Type.GetType("OP.Client.Html.Resources.KenFengFormMethod");取值为NULL
Type.GetType("OP.Client.Html.Resources.KenFengFormMethod,OP.Client.Html.Resources");才能取到值。
故: var trueTypeFullName = string.Format("{0},{1}", typeFN, typeFN.Substring(0, typeFN.LastIndexOf('.')));
2.private修饰的不支持持久化保存。
3. [HideInInspector]隐藏的是支持持久化保存的。