I’ve created a modular entity system, wherein each module of the entity has an associated array of ‘conditionals’, which are scriptable objects with an abstract function returning a bool. Is it possible to reference a bool within the inspector? For example, I might have a ‘stunned’ bool, or a ‘gamePaused’ bool, and I would want to be able to somehow reference and check the value of those bools. I am aware of ‘ref’ but don’t know how to extend this into the editor.
I want something similar to how you would drag in a transform, but rather be a reference to a bool. I want to then be able to read that bool, and have it so that if the bool changes in it’s local script, the conditional would update the changes. I also want this to be modular, so simply writing in script ‘if(entity.stunned)’ is not acceptable, because then I would need to create a new ‘conditional’ extension for each different bool. (one for if(gameManager.isPaused), another for if(entity.isAlive) etc)
_
A clarification if it isn’t clear:
I have bools in other classes that are updated in their own special ways. I want to be able to, through the editor, create a reference to that variable. If the player was stunned for example, a script would set entity.stunned = true. By storing a reference to the bool, an external class would (hopefully) also see the change, since I want to store a reference to the bool. A reference to the bool is not the same as making a new bool and setting it equal to the existing bool, since a change to the existing bool wouldn’t affect the new one. I want a reference, similar to how you would reference a class. You SET bools, ints and vectors, but you REFERENCE classes. I want to be able to REFERENCE a bool, int or vector, similar to how you would with the ‘ref’ function. But most importantly, I want to reference it through the inspector.
Sorry if this is more or less a reiteration, I’m just not sure how to better communicate my question…