Forum rules - please read before posting.

Variable check running actions from both states

I've got an in-scene action list that is exhibiting some unexpected behaviors.

Right now a trigger and a hotspot as their first action call an in-scene action list.
image

That action list, as its first action, performs a local variable check, with two branches
image

That first branch, in cyan, switches the scene, and is so far handling successfully EXCEPT that once the scene switches, I then see an alert pop up that should only run if the variable checked is false, and in that case the scene should not switch.

That both is occurring is very head-scratching.

I've validated that the variable is in fact set to true when this phenomenon occurs.
image

I'm using Unity 2020.3.20f1, and AC v1.74.0.

What other info can I provide to help get this figured out?

Comments

  • The Variable you're dealing with is a Local one, so it won't exist in the other scene.

    Once you switch scene, any Local variable you reference will be for this new scene - not the original.

    Which variable is the alert popup basing its display on? If you require a variable to be accessable across multiple scenes, it will need to be Global.

    You can convert a Local variable to a Global one via the cog icon beside it in the Variables Manager.

  • Thanks for looking in, Chris!

    I did change the variable to global; thanks for your helpful instructions on that, but I'm still seeing the problem alert crop up.

    The fact that the variable was local is exactly the desired behavior, since I only want the system to evaluate said in the original scene. My desired behavior is that the scene switch should happen based on the variable eval. The next scene doesn't need to use that variable, so local, it seems to me, was the correct scope, but as long as I'm not adding massive overhead by using too many globals, I'm happy to just use a global in this case.

    But even after changing from local to global, for whatever reason, the engine is successfully evaluating the variable as true in one scene, performing the expected behavior, and then after scene switch is then exhibiting some behavior from the false branch. Which, considering as I understand it that normally you have to do some special saving stuff to get logic to run from one local Action List after scene swap, and I haven't done that--it's especially baffling.

    Here's a visual manifestation of my understanding of the problem so far.

  • Ok, I've just created some data that suggests it's not the variable eval at all--it's may be that everything in the ActionList is getting run at some point, regardless if it's actually connected into the flow of logic.

    I did a test just now where I disconnected the alert branch entirely from the variable eval. So right now in my understanding, the actions with the alert shouldn't run, because they're not connected to the Action 0 at all.

    They do, though; after the scene switch. The variable check is performing flawlessly, but after scene change, Node 2 appears to run, and successfully arrives at Node 9.

  • Thank you for the clear explanation!

    I misunderstood your original post - I was under the impression that the Action that triggers the alert was part of Scene B. Going by your diagram, I don't see a need for the variable to be Global after all.

    I believe this issue is related to a bug that was fixed in v1.74.2. From the Changelog:

    • Fixed: "Scene: Switch" Action not ending its ActionList under certain conditions

    In a backup/dupliated project, import the latest release and see if this issue remains.

  • You were correct, that was the issue!

    Turns out I had the same problem as another user where Unity's package manager caching issues led me to think I was current, when I was actually behind on AC. Thank you also for the suggestion to clear one's Unity cache.

    Sorry Unity is making trouble for you! Thank you so much for the help resolving this!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.