// Use this for initialization
 void Start()
 {
     if (obj == null)
     {
         obj = ScriptableObject.CreateInstance <MySerializedProperty>();
     }
     serializedObject           = new UnityEditor.SerializedObject(obj);
     serializedPropertyFloatVar = serializedObject.FindProperty("FloatVar");
 }
コード例 #2
0
    public static void CreateMyAsset()
    {
        MySerializedProperty asset = ScriptableObject.CreateInstance <MySerializedProperty>();

        AssetDatabase.CreateAsset(asset, "Assets/MySerializedProperty.asset");
        AssetDatabase.SaveAssets();

        EditorUtility.FocusProjectWindow();

        Selection.activeObject = asset;
    }