I'm having some strange problems right now related to variables and my menu system, maybe someone knows what's going wrong.
I'm trying to run a cutscene following a variable change. It's a local variable, and the way I change its value is when the player opens a menu and clicks a specific button, a script runs that says: LocalVariables.SetBooleanValue(0, true), and closes the menu. That's when the cutscene should kick in, but it doesn't.
I then tried to bind that same line of code to a keypress to see if it was a problem in the map menu logic, but no luck there. Even putting it as a global variable instead didn't work. The only way it works is if I change the variable value with another cutscene. But that won't do because it needs to trigger from that menu script (for reasons).
-
Then, problem 2: In the scene directly following this one, I have a problem with another menu. The menu contains an inventory grid, and clicking on each item runs an ActionList that puts a bit of text on a label in that same menu. But when I open that menu in this scene, I cannot click on any of the inv items, nothing happens. To complicate things, the EXIT button in the corner of the menu DOES work.
Also, when this menu is closed, there is a little notification badge on it telling you if there is new information (a new item in the grid, basically). I do this by checking against a (global) variable and displaying its value on the badge label, something that works fine in the scene I mentioned above, but doesn't work in this scene, even though I change the value from a cutscene here! It used to work in earlier builds, I know that much. The rest of the cutscene plays just fine, but no badge shows up after it, and like I said, the related menu is unresponsive.
I hope it is somewhat understandable what I tried to explain here ha.
Comments
The "On Variable change" Cutscene won't be triggered if you manually change a variable through script - only when using the Variable: Set Action. If you must call a script, you can trigger the Cutscene through script as well:
GameObject.FindWithTag (Tags.gameEngine).GetComponent <SceneSettings>().cutsceneOnVarChange.Interact ();
2)
You'll need to back up a bit, because I don't follow this "menu closed" business. You're saying it all works in one scene but not the other? Could be to do with whether or not the game is paused or not. When the game is running, look at the PersistentEngine gameobject's StateHandler component and compare the Game State value between the two scenes. That could offer a clue.
1) The menu with the "Variable label" is not turned off
2) The "Variable label" element is hidden
3) It's displayed underneath another menu or element
How are you getting the label to disappear if the Variable is zero? Perhaps that ActionList needs to be re-run.
What do you mean by using the Object: Send message Action to change the variables? I'm not quite clear on how this Cutscene is being run.