playMaker

Author Topic: Scene issues [SOLVED]  (Read 200 times)

obstudio

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Scene issues [SOLVED]
« on: October 21, 2017, 07:08:38 AM »
Hi all,
I've started to playing with scenes using PM and found some issues (not sure if they are errors, or I'm doing something wrong). In both cases PM is not showing any error, Console also is clear.

1. I'm loading new scene additive but before activation of this scene I want to play some animation. That's why I'm not using "Allow Scene Activation" in "Load Scene Async". Instead of it I try to use "Set Active Scene" called by "Pending Activation Event".
What's happening: Scene is loaded additive, ..., state with action "Set Active Scene" is loaded and FSM states in this state but this new Scene is not active. For debug purposes I've added all possible events to this action, but none of them is activated.

2. Another case. After additive scene load (with auto activation) I try to "unload" the old scene. Event is called, old scene in "Hierarchy" tree is getting grey but in Game window I still see canvas from this old scene (from new of course also).
« Last Edit: October 25, 2017, 12:28:16 PM by djaydino »

Deek

  • Junior Playmaker
  • **
  • Posts: 63
    • View Profile
Re: Scene issues
« Reply #1 on: October 21, 2017, 09:16:37 AM »
1. You need to pass over the "A Sync Operation Hash Code" as a variable from 'Load Scene Async' to 'Allow Scene Activation' (says it also in the Tooltip if you hover over it). You can also only allow the activation after the loaded scene is pending activation, therefore you have the option to send an event or set a bool when "Pending Activation".

2.Does any of the GameObjects from the old scene that stay in the new scene have a Dont Destroy On Load action or script attached? Also do you use the action "Unload Scene Asynch" for that?

obstudio

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: Scene issues
« Reply #2 on: October 22, 2017, 12:15:10 PM »
1. Unfortunatelly it's not working. As I understand first part of "Load Scene Asynch" are parameters passed to method represented by this action, and "result" part is what this method can return or events that could be triggered. In my case "pending activation event" which as tooltip said is send when scene loading is done but scene not yet activated is triggered, and after this I see in "Hierarchy" box that loaded scene is "grey" and has label "(is loading)". So it look's like scene is
 a) not loaded and event shall not be triggered or
 b) scene is loaded but scene state is not changed, that's why it cannot be activated. Interesting is that "Set Active Scene" action doesn't trigger any event (even error).

"A Sync Operation Hash Code" is something that I totally not understand. As said in tooltip "... you'll need this to use it in the action 'AllowSceneActivation' to effectivily load the scene."
I can't see action named 'AllowSceneActivation'

2. None of GameObjects from old scene have "Don't destroy on load". Yes I'm using "Unload Scene Async"

obstudio

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: Scene issues
« Reply #3 on: October 22, 2017, 03:10:13 PM »
Little update after updating Unity to 2017.2
1. "Set Active Scene" action in result shows "Scene Found" as false but "Scene Not Found Event" is not triggered by this action.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Scene issues
« Reply #4 on: October 23, 2017, 02:41:05 AM »
Hi,

 ok, I'll have a go at all of this and get back to you when I found something,won't have time today, but just wanted to let you know, I am no this.

 Bye,

 Jean

obstudio

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: Scene issues
« Reply #5 on: October 23, 2017, 01:59:07 PM »
Thanks.
FYI I've recreated this situation in new project, and this time after "pending activation event" was triggered I see console error

Quote
ArgumentException: SceneManager.SetActiveScene failed; scene 'Level' is not loaded and therefore cannot be set active
UnityEngine.SceneManagement.SceneManager.SetActiveScene (Scene scene) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/SceneManagerBindings.gen.cs:45)
HutongGames.PlayMaker.Actions.SetActiveScene.DoSetActivate () (at Assets/PlayMaker/Actions/SceneManager/SetActiveScene.cs:129)
HutongGames.PlayMaker.Actions.SetActiveScene.OnEnter () (at Assets/PlayMaker/Actions/SceneManager/SetActiveScene.cs:79)
HutongGames.PlayMaker.FsmState.ActivateActions (Int32 startIndex) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:199)
HutongGames.PlayMaker.FsmState.OnEnter () (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:169)
HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2670)
HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2628)
HutongGames.PlayMaker.Fsm.UpdateStateChanges () (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2556)
HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2686)
HutongGames.PlayMaker.Fsm.Update () (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1920)
PlayMakerFSM.Update () (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:532)

BTW: those absolute paths are not from my PC (it look's like they are hardcoded)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Scene issues
« Reply #6 on: October 24, 2017, 12:33:30 AM »
Hi,

 can you share this project you created to replicate this? pm me if necessary.

Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Scene issues
« Reply #7 on: October 25, 2017, 02:02:23 AM »
Hi,

 Ok, I see, two things :

1: I think that for your normal usage, you should always allow the scene being loaded to be activated as soon as it's loaded, so you need to set "allow scene activation" to true in "Load Scene asynch" and catch the load using the done event, and not care about the pending activation event

2: the AllowSceneActivation was badly formated... it was flag obsolete ( for some reason, I will correct this and it will be available on the next PlayMaker update, meanwhile, I have attached the corrected action on this post.

I also attached the corrected fsm so that you can testify.

Let me know how it goes.

 Bye,

 Jean

obstudio

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: Scene issues
« Reply #8 on: October 25, 2017, 12:06:50 PM »
Hi,

it works fine now.

Thanks for quick fix