Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ExportGO(go:GameObject, froot:String)
- {
- var path : String = froot + "/" + go.name ;
- var orig : GameObject = Instantiate (go.gameObject,
- go.gameObject.transform.position, go.gameObject.transform.rotation);
- var prefab : UnityEngine.Object = EditorUtility.CreateEmptyPrefab( path + ".prefab");
- AssetDatabase.Refresh();
- EditorUtility.ReplacePrefab(orig, prefab );
- AssetDatabase.Refresh();
- DestroyImmediate(orig );
- DestroyImmediate(go.gameObject);
- var clone : UnityEngine.Object = EditorUtility.InstantiatePrefab( prefab ) ;
- Debug.Log(clone cast GameObject);
- //Remove the tiles
- FileUtil.DeleteFileOrDirectory("Assets/BatchingToolsTemp");
- AssetDatabase.Refresh();
- AssetDatabase.SaveAssets();
- }
Add Comment
Please, Sign In to add comment