- Home /
Preventing users from editing specific properties in any arbitrary inspector _without_ creating custom inspectors?
Hey everyone! This is a tricky one...
What I'm trying to do is to create a system where specific properties can be locked in the inspector - not just for my own components, but for any arbitrary component in the project.
I have the first step done - I've written a component that can be added to a prefab that will use reflection to scan through all components/properties of the game object, and save out which ones a user would like to lock.
What I need now is to be able to somehow access the Inspector Window and either:
a) Inject my own code into each component's OnInspectorGUI to disable the marked properties.
b) Set the properties as [HideInInspector] (or some other similar attribute) dynamically, which will cause the default OnInspectorGUI code for that component to skip over (or ideally - gray out) the property.
c) Some other means to modify a default inspector without needing to create a custom editor for every type of component I can hit through my reflection.
This seems nearly impossible to do... but does anyone have any ideas?