示例#1
0
 private void OnEnable()
 {
     _target = (GameStructure)target;
     if (_target.GetComponent <BoxCollider>())
     {
         _target.GetComponent <BoxCollider>().hideFlags = HideFlags.HideInInspector;
     }
 }
示例#2
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        if (_target.GetComponent <Collider>() == null)
        {
            return;
        }

        if (_target.width != _target.GetComponent <BoxCollider>().size.x)
        {
            EditorGUILayout.LabelField("The platform size has changed. It need to be rebuilt");
        }

        bool buttonBuild = GUILayout.Button("Build", GUILayout.Height(2 * EditorGUIUtility.singleLineHeight));

        if (buttonBuild)
        {
            _target.Build();
        }
    }