Created
September 9, 2011 03:28
-
-
Save keijiro/1205428 to your computer and use it in GitHub Desktop.
Workaround for asset reference problem.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@MenuItem ("MyMenu/Do Something") | |
static function DoSomething () { | |
var header1 = ScriptableObject.CreateInstance.<StateHeader>(); | |
var header2 = ScriptableObject.CreateInstance.<StateHeader>(); | |
AssetDatabase.CreateAsset(header1, "Assets/State1Set.asset"); | |
AssetDatabase.CreateAsset(header2, "Assets/State2Set.asset"); | |
var state1 = ScriptableObject.CreateInstance.<State1>(); | |
var state2 = ScriptableObject.CreateInstance.<State2>(); | |
state1.reference = state2; | |
state2.reference = state1; | |
AssetDatabase.AddObjectToAsset(state1, header1); | |
AssetDatabase.AddObjectToAsset(state2, header2); | |
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(state1)); | |
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(state2)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment