예제 #1
0
        //[MenuItem("Tools/Runtime SaveLoad/Libraries/Update Asset Libraries List")]
        private static void CreateAssetLibrariesList()
        {
            AssetLibrariesListAsset asset = AssetLibrariesListGen.UpdateList();

            Selection.activeObject = asset;
            EditorGUIUtility.PingObject(asset);
        }
예제 #2
0
        private static void CreateAssetLibrary()
        {
            AssetLibraryAsset asset = ScriptableObject.CreateInstance <AssetLibraryAsset>();

            int identity = AssetLibrariesListGen.GetIdentity();

            asset.Ordinal = identity;

            string path             = AssetDatabase.GetAssetPath(Selection.activeObject);
            string name             = "/AssetLibrary" + ((identity == 0) ? "" : identity.ToString());
            string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(path + name + ".asset");


            asset.AssetLibrary.Folders[1].Assets = new List <AssetInfo>
            {
                new AssetInfo
                {
                    id     = 1,
                    name   = "Material",
                    Object = AssetDatabase.LoadAssetAtPath <Material>("Assets/New Material.mat")
                }
            };


            AssetDatabase.CreateAsset(asset, assetPathAndName);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            Selection.activeObject = asset;

            AssetLibrariesListGen.UpdateList(identity + 1);
        }
예제 #3
0
 private void OnValidate()
 {
     if (Event.current != null && Event.current.commandName == "Duplicate")
     {
         int identity = AssetLibrariesListGen.GetIdentity();
         Ordinal = identity;
         EditorCoroutine.Start(CoUpdateList(identity));
     }
 }
예제 #4
0
        private static void CreateAssetLibrary()
        {
            AssetLibraryAsset asset = ScriptableObject.CreateInstance <AssetLibraryAsset>();

            int identity = AssetLibrariesListGen.GetIdentity();

            asset.Ordinal = identity;

            string path             = AssetDatabase.GetAssetPath(Selection.activeObject);
            string name             = "/AssetLibrary" + ((identity == 0) ? "" : identity.ToString());
            string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(path + name + ".asset");

            AssetDatabase.CreateAsset(asset, assetPathAndName);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            //Selection.activeObject = asset;

            AssetLibrariesListGen.UpdateList(identity + 1);
        }
예제 #5
0
        private IEnumerator CoUpdateList(int identity)
        {
            yield return(null);

            AssetLibrariesListGen.UpdateList(identity + 1);
        }