M
M
Mimocodil2021-11-25 16:00:18
Unity
Mimocodil, 2021-11-25 16:00:18

How to hide and show part of the component's fields in the inspector?

The content of the Light component changes depending on the selected type of lighting. I want to do something similar: depending on the position of the canMove and canRotate switches, additional options should appear and hide, which are shown below. How to implement it?

...
  public bool canMove = false;
  public Vector3[] positions;
  public float moveSpeed = 3f;
  int index = 0;

  public bool canRotate = true;
  public Direction direction = Direction.x;
  public float rotationSpeed = 1.5f;
...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GFX Data, 2021-11-26
@Ezekiel4

ConditionalField from MyBox library - https://github.com/Deadcows/MyBox/wiki/Attributes#...
61a07c4a7adc4954160592.gif

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question