Guest User

Untitled

a guest
Apr 21st, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     function ExportGO(go:GameObject, froot:String)
  2.     {
  3.         var path : String = froot + "/" + go.name ;
  4.         var orig : GameObject = Instantiate (go.gameObject,
  5.         go.gameObject.transform.position, go.gameObject.transform.rotation);
  6.        
  7.         var prefab : UnityEngine.Object = EditorUtility.CreateEmptyPrefab( path + ".prefab");
  8.         AssetDatabase.Refresh();
  9.         EditorUtility.ReplacePrefab(orig, prefab );
  10.         AssetDatabase.Refresh();
  11.        
  12.         DestroyImmediate(orig );
  13.         DestroyImmediate(go.gameObject);
  14.         var clone : UnityEngine.Object = EditorUtility.InstantiatePrefab( prefab ) ;
  15.         Debug.Log(clone cast GameObject);
  16.         //Remove the tiles
  17.         FileUtil.DeleteFileOrDirectory("Assets/BatchingToolsTemp");
  18.         AssetDatabase.Refresh();
  19.         AssetDatabase.SaveAssets();
  20.        
  21.     }
Add Comment
Please, Sign In to add comment