playMaker

Author Topic: iTweenStop after Application.LoadLevel() and FIX  (Read 3004 times)

delstrega

  • Playmaker Newbie
  • *
  • Posts: 2
    • View Profile
iTweenStop after Application.LoadLevel() and FIX
« on: April 27, 2012, 03:36:54 AM »
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: [Select]
iTween.StopByName(id.Value);
in iTweenStop.cs in the Action Folder I use:

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

iTween.StopByName(go,id.Value);

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

  • Administrator
  • Hero Member
  • *****
  • Posts: 3637
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: iTweenStop after Application.LoadLevel() and FIX
« Reply #1 on: May 02, 2012, 05:24:09 PM »
Thanks! I'll get the fix into the next update...