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