Hey all. Working through the AC tutorial in bits and pieces. Had a weird bug and solved it, but the process revealed an underlying question about how AC works, or whether I might have found a bug:
- In scene A, I created a hotspot to switch to scene B.
- In scene A, I wanted an NPC to say something to you as you leave if you had given that NPC a specific item.
- I added logic to the ActionList for the hotspot: When I was done, Node-0 checked for a variable. If true, it triggered Node-2, which printed the line ("Thanks for choosing me.") and then redirected to Node-1, which switched scenes. If the variable was false, Node-0 directed to Node-1, switching scenes.
- Scene transition worked fine. BUT when the variable was true, "Thanks for choosing me" was printed TWICE, once at the end of scene A, and then again at the beginning of Scene B.
- Unsure what to change to fix this bug, I reordered the nodes in the ActionList.
- Previously: 0 = variable check, 1 = switch scenes, 2 = print line if true
- Currently: 0 = variable check, 1 = print line if true, 2 = switch scenes
- That cleared up the bug completely
So, here's my question: Do the numbers on the nodes in an ActionList always matter like that? Will the highest number always fire at the end even if it isn't supposed to have fired at all? Do I need to be careful about the order of the nodes when I add new logic to make sure the node numbers don't introduce bugs?
The bug is fixed now so I don't have screenshots of the old state, but I can try to reproduce the problem if necessary.
Thanks all,
-James
Comments
Welcome to the community, @williamj35. Apologies for your trouble.
The only circumstance that Action ordering should come into play is if an Action's output is set to "Continue" - in which case it'll run the next one listed.
Are you working with your ActionLists in the ActionList Editor? This is the recommended way of working, as opposed to directly in the Inspector. In the dedicated Editor, it's much easier to see how your Actions chain together. You should not have to worry about the addition of new Actions being run unexpectedly - the connections that appear in the Editor should match the flow of logic at runtime.
To be clear: when you say "print line", are you referring to NPC speech (performed with the Dialogue: Play speech Action), or displaying text in the Unity Console (ActionList: Comment)?
If speech is involved, could it be that the issue is more related to the Subtitles menu's display being carried over from one scene to the next? What steps did you take to solve the issue?
Hey Chris! Thanks for the reply.
Yep. I'm working in the ActionLists Editor. It's very handy.
And yes, sorry. When I say "print line" I do mean Dialogue: Play speech, not anything with the console.
The effect was the subtitle menu's display being carried over from one scene to the next! That is correct. Is that a different issue?
The way I resolved it was by changing the "ordering numbers" on the Actions. I just made it so that the Action with the highest number was the one that transitioned to the next scene.
Any currently-running speech should end at the moment the scene transitions, but without seeing the ActionList I can't tell if this was a case of the same speech line surviving the change, or the original Action being called again.
What's your AC version, and are you using the default Subtitles menu? If you have the time, I'd appreciate it if you could share the details of the exact Actions / ActionList properties involved, but it's also fine if you want to move on and come back to this if you re-encounter it.
Hmm. I've played around with it some, but I can't seem to reproduce the bug. [shrug emoji] If I encounter it again I will document it better w/screenshots of the ActionList Editor etc.
Not sure which version of AC I've got? I installed a week and a half ago from the asset store. So I think its current? And yes I'm using the default subtitle menus. My next goal is to learn how to customize them.
Thanks for your help.