Bug Reporting > PlayMaker Bug Reporting

iTweenStop after Application.LoadLevel() and FIX

(1/1)

delstrega:
I get a "Missing Reference Exception" if I reload my Scene by using Application.LoadLevel()
and the iTweenStop-Action (with id) fires in one of my FSMs.
Everything works fine before I reload my scene.

It seems it doesn't like it if an "id" is supplied to iTweenStop after the Application.LoadLevel() since somehow the reference to the GameObject gets lost.

My fix:
instead of using

--- Code: ---iTween.StopByName(id.Value);

--- End code ---
in iTweenStop.cs in the Action Folder I use:


--- Code: ---GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null)
{
return;
}

iTween.StopByName(go,id.Value);

--- End code ---

I hope that helps anyone with a similar problem.

Just for completeness, here's the ErrorLog:
MissingReferenceException: The object of type 'GameObject' 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.
UnityEngine.GameObject.GetComponents (System.Type type) (at C:/BuildAgent/work/b0bcff80449a48aa/Runtime/ExportGenerated/Editor/UnityEngineGameObject.cs:63)
iTween.StopByName (UnityEngine.GameObject target, System.String name) (at Assets/iTween/iTween.cs:6445)
iTween.StopByName (System.String name) (at Assets/iTween/iTween.cs:6393)
HutongGames.PlayMaker.Actions.iTweenStop.DoiTween () (at Assets/PlayMaker/Actions/iTween/iTweenStop.cs:56)
HutongGames.PlayMaker.Actions.iTweenStop.OnEnter () (at Assets/PlayMaker/Actions/iTween/iTweenStop.cs:30)

Alex Chouls:
Thanks! I'll get the fix into the next update...

Navigation

[0] Message Index

Go to full version