public override void Action(int instanceId, string pathName, string resourceFile)
            {
                var spriteAtlasAsset = new SpriteAtlasAsset();

                UnityEditorInternal.InternalEditorUtility.SaveToSerializedFileAndForget(new Object[] { spriteAtlasAsset }, pathName, true);
                AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
            }
Esempio n. 2
0
        public static void Save(SpriteAtlasAsset asset, string assetPath)
        {
            if (asset == null)
            {
                throw new ArgumentNullException("Parameter asset is null");
            }
            var objs = new UnityEngine.Object[] { asset };

            UnityEditorInternal.InternalEditorUtility.SaveToSerializedFileAndForget(objs, assetPath, UnityEditor.EditorSettings.serializationMode != UnityEditor.SerializationMode.ForceBinary);
        }
        private string LoadSourceAsset()
        {
            var assetPath     = AssetDatabase.GetAssetPath(target);
            var loadedObjects = InternalEditorUtility.LoadSerializedFileAndForget(assetPath);

            if (loadedObjects.Length > 0)
            {
                m_TargetAsset = loadedObjects[0] as SpriteAtlasAsset;
            }
            return(assetPath);
        }
 protected override void Apply()
 {
     if (HasModified())
     {
         if (spriteAtlasAsset)
         {
             SpriteAtlasAsset.Save(spriteAtlasAsset, m_AssetPath);
         }
         m_ContentHash = GetInspectorHash();
     }
     base.Apply();
 }
Esempio n. 5
0
 extern private static void Internal_Create([Writable] SpriteAtlasAsset self);