Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEditor;
- using System.Collections;
- using System.Text;
- using System.IO;
- namespace AssemblyCSharpEditor
- {
- public class LayerExporter : ScriptableWizard {
- private StreamWriter writer;
- public GameObject gameObject;
- private int count;
- [MenuItem ("GameObject/Export Layers")]
- static void CreateWizard () {
- ScriptableWizard.DisplayWizard("Export Layers", typeof (LayerExporter),"Export");
- }
- void OnWizardCreate () {
- count = 0;
- using (writer = new StreamWriter ("layers.txt"))
- {
- Pew(gameObject);
- }
- Debug.Log (count);
- }
- void Pew(GameObject g)
- {
- if (g.layer != 0) {
- count++;
- writer.WriteLine (g.name + ":" + g.layer);
- }
- foreach(Transform t in g.transform)
- {
- Pew(t.gameObject);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment