Hi, I'm trying to create an action list asset that can open or close a drawer. I want to give a parameter with the game object to animate and another one with a boolean to check the state it is currently set. Example: If the drawer is opened then close it, same the other way around. The problem is, they all share the same variable and I'm trying to store the boolean variable for only one drawer. I know I can give to each drawer a different global variable, but managing 20 or more variables for drawers will be a pain to organize. So I thought I could somehow use private variables and store info there, but I couldn't find how I could do it.
I also thought that the local variables could somehow be private, but they add the same result as the global ones.
Maybe I'm doing something wrong, but my conclusion was that Adventure Creator doesn't feature private variables.
Comments
A tutorial on custom Actions, if that's something that interests you, can be found here. A custom "checking" Action is a little more complicated - it must derive from ActionCheck, and must include an overriding CheckCondition function which returns the final result as a boolean. The simplest such Action, Object: Check visibility, can be used as an example in ActionVisibleCheck.cs. We can give more help if you're not experienced with C# coding, but I'll wait to hear if that interests you first.
Back to the issue of private variables - an asset cannot access local variables, as they live in scenes while assets do not. The same would therefore have to be true of private variables, which to my mind would come as a script you could attach to an object, and then use that to define a separate set of variables much like you do already in the Variables Manager. But the hassle of creating e.g. 20 such scripts would be equal if not more so than creating 20 global/local variables, so I'm not sure of the benefits there.
What I would recommend, if you don't want to go down the custom Action route, is that you rely on scene-based Cutscenes rather than ActionList assets. This will allow you to reference Local variables, rather than Global variables, which will at least mean you don't have them cluttering up your Variables Manager in other scenes. You can convert an existing ActionList asset into a Cutscene via the cog icon to the top-right of its Inspector.