Watchful11

Export Script

Nov 18th, 2014
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEditor;
  3. using System.Collections;
  4. using System.Text;
  5. using System.IO;
  6.  
  7. namespace AssemblyCSharpEditor
  8. {
  9. public class LayerExporter : ScriptableWizard {
  10.  
  11. private StreamWriter writer;
  12. public GameObject gameObject;
  13. private int count;
  14. [MenuItem ("GameObject/Export Layers")]
  15.  
  16. static void CreateWizard () {
  17. ScriptableWizard.DisplayWizard("Export Layers", typeof (LayerExporter),"Export");
  18. }
  19.  
  20. void OnWizardCreate () {
  21. count = 0;
  22. using (writer = new StreamWriter ("layers.txt"))
  23. {
  24. Pew(gameObject);
  25. }
  26. Debug.Log (count);
  27. }
  28.  
  29. void Pew(GameObject g)
  30. {
  31. if (g.layer != 0) {
  32. count++;
  33. writer.WriteLine (g.name + ":" + g.layer);
  34. }
  35. foreach(Transform t in g.transform)
  36. {
  37. Pew(t.gameObject);
  38. }
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment