标签:
//----create a scriptable object and add it to an existing asset
CmyScriptableObject obj = ScriptableObject.CreateInstance<CmyScriptableObject> ();
AssetDatabase.AddObjectToAsset(obj,existingAsset);
// Reimport the asset after adding an object.
// Otherwise the change only shows up when saving the project
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(obj));
Selection.activeObject = obj;
//----remove object in asset
//ref : http://answers.unity3d.com/questions/219465/how-can-i-remove-an-object-from-an-asset.html
UnityEngine.Object.DestroyImmediate(obj, true);
AssetDatabase.SaveAssets();
unity, add object to asset and remove object from asset
标签:
原文地址:http://www.cnblogs.com/wantnon/p/5095651.html