I’m curious if there is a way to have a bool or a check box that once checked to hide a public transform. For example
public class NPC : MonoBehaviour {
public Transform FaceImage;
public bool DisableFace = false; <--------- if this is checked I want to disable the public Transform “FaceImage” in the inspector. so it doesn’t show up. how would one go about doing this?
A custom inspector would be the way to go then. IIRC, it’s possible to do it with property drawers as well, but it’s a bit tricky and may require adding a method to the MonoBehaviour class itself.
Some references:
I also found the tutorials at Catlike Coding helpful:
Yup as said, custom inspectors are the way to go here.
From an UX point of view, I’d encourage you to group together the Face properties, and maybe just disable (grey out) the Face Image property instead of hiding it. That makes the connection between the checkbox and the property more obvious, and it also won’t cause a reformat of the other properties where they can jump around and throw the user off a little bit when they’re trying to find a property in a specific location.