예제 #1
0
        private T AddOrReplaceAsset <T>(T asset, Node node, AGXUnity.IO.AssetType type)
            where T : UnityEngine.Object
        {
            var existingAsset = AssetDatabase.LoadAssetAtPath <T>(FileInfo.GetAssetPath(asset));

            if (existingAsset == null)
            {
                FileInfo.AddAssetToDataDirectory(asset, type);
                existingAsset = asset;
            }
            else
            {
                EditorUtility.CopySerialized(asset, existingAsset);
            }

            return(existingAsset);
        }