Hello!
Is it possible to create an Action Scene/Switch next (the opposite of Scene/Switch previous)? I tried to modify the script, but my ignorance of C# is devastating.
Could someone help me with that?
Thank you,
Suely
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
To clarify: the "Switch previous" command refers to the last-visited scene - not the next scene up in Unity's build settings.
But as for a custom Action, try this:
Thank you very much!
Sorry to bother you again, but I tried placing it in several folders (inclusing a Custom Actions folder) and keep getting a message saying that the script "must derive fro AC's Action class in order to be available as an Action".
Could you help me with this as well?
Thank you
Suely
The AC debug logger:
-> AC debug logger
UnityEngine.Debug:LogError (object,UnityEngine.Object)
AC.ACDebug:LogError (object,UnityEngine.Object) (at Assets/AdventureCreator/Scripts/Static/ACDebug.cs:46)
AC.AdventureCreator:AddActionsFromFolder (AC.ActionsManager,string,System.Collections.Generic.List`1<AC.ActionType>) (at Assets/AdventureCreator/Scripts/Managers/Editor/AdventureCreator.cs:590)
AC.AdventureCreator:RefreshActions () (at Assets/AdventureCreator/Scripts/Managers/Editor/AdventureCreator.cs:495)
AC.AdventureCreator:OnEnable () (at Assets/AdventureCreator/Scripts/Managers/Editor/AdventureCreator.cs:39)
Check that the script's filename matches the class, i.e. ActionSceneNext.cs, and make that the scripts inside the folder it's placed in are exclusively Action scripts.
Naming as your example did the trick, thank you!
As stated in the previous comment, the error message has been solved. However, the action does not run
I have tried with normal scene names ('start' and 'second') and naming with numbers ('1' and '2'). I have also tried creating another hotspot switching to the second scene by name and coming back to the first one, just in case.
No error message, though: it identifies the area as a hotspot (or button), but it is as if no action had been specified.
Try running the ActionList its placed in manually, by clicking "Run now" in its Inspector.
Are your scenes added to the build settings, and do any messages appear in the Console?
nope...
I have a second hotspot and button going to the next scene by name and they work. No error message either.
I placed a build here (B&W arrow uses the next scene name, button and white arrow use the next scene script) here https://drive.google.com/drive/folders/1xAe1P7CW4zIFjrKcaxs6dkMQW1OENyDF?usp=sharing in case you want to see it, but I suspect I should try to find alternatives.
I must apologise - it was a typo in the script.
I've amended it above, please give it another go.
It works!
No reason to apologize: you are the best!
Hello, Chris. You have made this script for me a year ago, making it possible to use a "switch next" action which should make the Player to the next scene in the build settings. This has been very important for my game (and thank you again!)
During playtests I discovered that if, for any reason, the player returns to a previously visited scene, the "switch next" action sends to the scene last visited instead of the next scene in the build settings.
I'm not sure the explanation above is clear, so I'll explain another way:
Player is in scene 1 -> action sends to scene 2
Player is in scene 2 -> action sends to scene 3
Player is in scene 3 -> action sends to scene 4
Game throws player back to scene 1 -> action sends to scene 4
Would it be too complicated to adjust it so
Player is in scene 1 -> action sends to scene 2
Player is in scene 2 -> action sends to scene 3
Player is in scene 3 -> action sends to scene 4
Game throws player back to scene 1 -> action sends to scene 2
?
Thank you in advance
That's the intent behind the script - it should do that already. I can't recreate any other behaviour.
Let's try some debugging. Above the line:
Copy/paste the following:
What does the Console show when it takes you to the wrong scene?
thank you for your quick response. I am glad it happened during recorded sessions, otherwise I would think I dreamt it.
Sorry to have bothered you unnecessarily
[I'll have more playtests next week and will let you know if it happens again]