public override void OnGUI(GeneratorsAsset gens) { Transform mm = MapMagic.MapMagic.instance.gameObject.transform; stamper = mm.GetComponentInChildren <MapMagicStamper>(); base.OnGUI(gens); if ((null == stamper || null != stamper && stamper.Generator != this) && layout.Button("Show Stamper")) { if (null == stamper || stamper.Generator != this) { if (null != stamper) { GameObject.DestroyImmediate(stamper.gameObject); } GameObject go = new GameObject("Stamper"); go.transform.parent = mm; stamper = go.AddComponent <MapMagicStamper>(); stamper.Generator = this; Selection.activeObject = stamper; } } else if (null != stamper && stamper.Generator == this && layout.Button("Hide Stamper")) { GameObject.DestroyImmediate(stamper.gameObject); } }
private void OnEnable() { stamper = (MapMagicStamper)target; }