示例#1
0
 static SimpleNoteData CreateInstance()
 {
     #if UNITY_EDITOR
     if (!AssetDatabase.IsValidFolder("Assets/SimpleNote/Resources"))
         AssetDatabase.CreateFolder("Assets/SimpleNote", "Resources");
     _instance = AssetDatabase.LoadAssetAtPath(filePath, typeof(SimpleNoteData)) as SimpleNoteData;
     if (_instance == null)
     {
         _instance = ScriptableObject.CreateInstance<SimpleNoteData>();
         AssetDatabase.CreateAsset(Instance, filePath);
         AssetDatabase.SaveAssets();
     }
     #else
     _instance = Resources.Load("SimpleNoteData.asset", typeof(SimpleNoteData)) as SimpleNoteData;
     #endif
     return _instance;
 }
示例#2
0
        static SimpleNoteData CreateInstance()
        {
#if UNITY_EDITOR
            if (!AssetDatabase.IsValidFolder("Assets/Plugins/SimpleNote/Resources"))
            {
                AssetDatabase.CreateFolder("Assets/Plugins/SimpleNote", "Resources");
            }
            _instance = AssetDatabase.LoadAssetAtPath(filePath, typeof(SimpleNoteData)) as SimpleNoteData;
            if (_instance == null)
            {
                _instance = ScriptableObject.CreateInstance <SimpleNoteData>();
                AssetDatabase.CreateAsset(Instance, filePath);
                AssetDatabase.SaveAssets();
            }
#else
            _instance = Resources.Load("SimpleNoteData.asset", typeof(SimpleNoteData)) as SimpleNoteData;
#endif
            return(_instance);
        }