Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: elvis75k on February 16, 2012, 07:44:47 PM

Title: Load Level Workflow 1.3
Post by: elvis75k on February 16, 2012, 07:44:47 PM
1st Congratulation for the 1.3 I already love it!
I've found many topics about the Load Level action and i can read that most issues have been addressed: https://hutonggames.fogbugz.com/default.asp?playmaker.1.7.3
http://hutonggames.com/playmakerforum/index.php?topic=458.0

Every time i reach my load level action num the scene load but then stop!

Code: [Select]
MissingReferenceException: The object of type 'PlayMakerFSM' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
HutongGames.PlayMaker.Fsm.SendEventToFsmOnGameObject (UnityEngine.GameObject gameObject, System.String fsmName, HutongGames.PlayMaker.FsmEvent fsmEvent)
HutongGames.PlayMaker.Fsm.Event (HutongGames.PlayMaker.FsmEventTarget eventTarget, HutongGames.PlayMaker.FsmEvent fsmEvent)
HutongGames.PlayMaker.Actions.SendEvent.OnEnter () (at Assets/PlayMaker/Actions/SendEvent.cs:39)
HutongGames.PlayMaker.FsmState.OnEnter ()
HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state)
I've workaround this disabling the toggles into the Debugging parameters in the PM Gui (script), but after upgrading to 1.3 this don't work anymore. Every scene that i need to load is unique and has it's own var and events, so i worked all my project with no preloader/manager kind of workflow...
I've made a test with 2 simple scenes where i have a button to load the level num 1 and this scene has a button that load back the level num 0: everything just works.
What's happend then? Need urgent help!

edit: How i fixed this..
Adding a FINISHED event to the Load Level Num that put the fsm into an empty state fix the editor to go in pause mode and the error disappear: in other words: now it work.
The whole experience was a real pain, i think that some cure for this must be added in background.
Sorry if i waste some of your time :)
Title: Re: Load Level Workflow 1.3
Post by: elvis75k on February 16, 2012, 09:38:42 PM
Hmm, it's a bit late in the night.. and i hope i can find an answer before i go to work tomorrow.
The fix i did before with the finish event to the load level is only working with 1.2.1
In 1.3 i can't pass this error.. and the editor will pause.
Code: [Select]
MissingReferenceException: The object of type 'PlayMakerFSM' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
HutongGames.PlayMaker.Fsm.SendEventToFsmOnGameObject (UnityEngine.GameObject gameObject, System.String fsmName, HutongGames.PlayMaker.FsmEvent fsmEvent)
HutongGames.PlayMaker.Fsm.Event (HutongGames.PlayMaker.FsmEventTarget eventTarget, HutongGames.PlayMaker.FsmEvent fsmEvent)
HutongGames.PlayMaker.Actions.SendEvent.OnEnter () (at Assets/PlayMaker/Actions/SendEvent.cs:39)
HutongGames.PlayMaker.FsmState.OnEnter ()
HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state)
Title: Re: Load Level Workflow 1.3
Post by: jeanfabre on February 17, 2012, 06:22:00 AM
Hi,

 odd, I am currently using load level num with 1.3 and it works fine. Are you sure you have properly set the "dontdestroyOnLoad" settings where appropriate?

 bye,

 Jean
Title: Re: Load Level Workflow 1.3
Post by: elvis75k on February 17, 2012, 08:26:54 AM
Hi, Jean.
I don't understand you: i never used dontdestoroyOnLoad except the one in the Load Level action.
I guess that this will keep only the FSM that contain Load Level. Right?
If this is correct, do i need to put this "dontdestoroyOnLoad" alone on every FSM until the error disappear?
Since i solve this on 1.2.1 i think that in 1.3 there's something new that look better the "abandoned" FSM and show the error. Is debugFlow an option to catch where i generate this bug?

Cheers
Title: Re: Load Level Workflow 1.3
Post by: elvis75k on February 17, 2012, 09:42:24 AM
I've set up the scene lo load itself when the button is pressed.
The same scene load ok but the error appear.
If i put "dontdestoroyOnLoad" to an object it cause more trouble than before, because the object itself is then duplicated in the hierarchy!
Title: Re: Load Level Workflow 1.3
Post by: Alex Chouls on February 17, 2012, 09:48:51 AM
Do you only get the error when set up to load itself? Or also when loading other scenes?
Title: Re: Load Level Workflow 1.3
Post by: elvis75k on February 17, 2012, 10:10:14 AM
Do you only get the error when set up to load itself? Or also when loading other scenes?


I get this error ever. Loading the same scene was just a test i did to try to catch who's guilty.
Title: Re: Load Level Workflow 1.3
Post by: Alex Chouls on February 17, 2012, 10:29:12 AM
Do you have a simple repro case you could send me?
Title: Re: Load Level Workflow 1.3
Post by: elvis75k on February 17, 2012, 10:50:51 AM
Thanks Alex, i've sent you a mail with the package of a scene causing problem.
Every scene in this project looks almost like this one, i hope you don't get scared about the mess..
Title: Re: Load Level Workflow 1.3
Post by: elvis75k on February 23, 2012, 07:10:44 PM
Hey Alex, have you seen my project?

I've finally found the cause of the "has been destroyed" error.
It was a big surprise for me: i have the habit to disable (read turn off) most of my game object (disabled before the editor run (born disabled)) and that's fine because this way i feel like i get some speed up (just a feeling).. but if any of the deactivate "actor" has an fsm component then booom! Of course this error only happend when the scene is loaded with an action. Sometime the error appear in v1.2.1 but without rules or predictable behaviour. In 1.3 and up ther's no room for coincidences..

What's your thought on that?

Title: Re: Load Level Workflow 1.3
Post by: Alex Chouls on February 23, 2012, 07:31:30 PM
That's a really good lead! I'll take another look...
Title: Re: Load Level Workflow 1.3
Post by: marcos on February 24, 2012, 12:23:01 AM
I think that this is related to the issue that I am having
Title: Re: Load Level Workflow 1.3
Post by: jeanfabre on February 24, 2012, 04:50:29 AM
Hi,

 I found the source of this problem.

there is indeed a bug:

if the sendevent action is set within the "START" state flow, then reloading the scene creates this error.

I get this error when reloading  the same scene while already playing, not when the application is loading the scene fro the very first time at launch.

and it seems to happen even if the event is trigger later on, as long as it is actually somehow part of the start flow. But I am not sure about this second findings, cause after I fixed the send event called straight on start state I still have the same issues on other fsm.


bye,

 Jean
Title: Re: Load Level Workflow 1.3
Post by: marcos on February 29, 2012, 07:49:50 AM
Hi,

 I found the source of this problem.

there is indeed a bug:

if the sendevent action is set within the "START" state flow, then reloading the scene creates this error.

I get this error when reloading  the same scene while already playing, not when the application is loading the scene fro the very first time at launch.

and it seems to happen even if the event is trigger later on, as long as it is actually somehow part of the start flow. But I am not sure about this second findings, cause after I fixed the send event called straight on start state I still have the same issues on other fsm.


bye,

 Jean

Hey,

Sorry to be a pest, but is there any word of how a fix for this is going?

Many thanks in advance,
Mark
Title: Re: Load Level Workflow 1.3
Post by: Alex Chouls on February 29, 2012, 01:04:53 PM
I'm looking into this, but still haven't managed to repro the problem on my end... so far all my tests are running fine...

If anyone has a simple repro project they could send me, that would be most helpful!
Title: Re: Load Level Workflow 1.3
Post by: marcos on February 29, 2012, 10:02:23 PM
Did the scene I sent you reproduce it on your end?

Could it be a Unity Basic vs Pro thing? I'm only on iOS Basic at the moment.
Title: Re: Load Level Workflow 1.3
Post by: jeanfabre on March 01, 2012, 12:33:52 AM
Hi,

 I'll try and build one, the thing is, this project is under nda, and I have to have the right to share it... so I need to extract the problem.

 Bye,

 Jean
Title: Re: Load Level Workflow 1.3
Post by: Alex Chouls on March 02, 2012, 05:24:08 PM
@marcos: Sorry somehow I misplaced that project - but I found it and am looking at it now... seems like a great repro - thanks!
Title: Re: Load Level Workflow 1.3
Post by: Alex Chouls on March 02, 2012, 07:42:01 PM
I think this is fixed (it seems that MonoBehaviour.OnDisable is NOT always called before OnDestroy...?).

Unfortunately the Unity Asset Store tools are a little broken at the moment, so I'm waiting for the fix before submitting an update.

In the meantime I sent out a beta for testing.
Title: Re: Load Level Workflow 1.3
Post by: marcos on March 02, 2012, 09:01:08 PM
Oh awesome! I hope my repro helped!

I don't think I get access to the google group from my hotmail address, so I sent you a request from my gmail account.

Thanks!
Title: Re: Load Level Workflow 1.3
Post by: elvis75k on March 08, 2012, 07:37:44 PM
Dear Alex, i have no more workaround (!) for this issue, and now i really need to go through. Is it possible for you to send me the fixed components from the beta release? Since i'm working at last 20 hours per day with pm, will you consider adding me to the playmaker beta team? i was in the early beta stage too.. remember?

Thanks, elvis.

edit: once again, removing the disabled FSM component in the scene did again fix the issue.
Title: Re: Load Level Workflow 1.3
Post by: Alex Chouls on March 14, 2012, 01:17:45 AM
@elvis75k: Did you get the beta invite? Did it fix the issue?
Title: Re: Load Level Workflow 1.3
Post by: elvis75k on March 14, 2012, 04:36:16 AM
@AlexChouls nope. Sent you a pm after checking in my empty message inbox.
In the mean time i can tell you something i've discovered: if i leave the scene num. 1 while iTween is running (iTween is moving the main.camera) i get the error on the loaded scene when another iTween start (not immedialely). If i stop the iTween before i leave the scene, all is fine.
Thank you!

 edit: my forum in/out box message is empty. Outbox must have been archived the pm i've just sent to you?