playMaker

Author Topic: Any way to tell Playmaker to process a state machine now?  (Read 2369 times)

andsee

  • Playmaker Newbie
  • *
  • Posts: 2
Any way to tell Playmaker to process a state machine now?
« on: September 19, 2012, 10:13:20 AM »
I have a problem where I'm enabling a set of objects so that they can start to be rendered. This occurs in the Update() of another mono behaviour in response to a mouse press. On one of these objects there is a Playmaker FSM which is responsible for doing a iTween Move From to instantly move my screen objects off screen and then move them into view.

The problem is that the state machine is not executed until after the scene has been rendered which results in a frame with everything visible before the MOve From had chance to move them out of the way.

When does Playmaker advance it's state machines and is there a way to tell it to execute one now.

Many thanks

Andsee

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Any way to tell Playmaker to process a state machine now?
« Reply #1 on: September 20, 2012, 01:59:33 AM »
Hi,

 I think you can tell itween to work on late update wich should then possibily solve your problem.

also, don't use itween to move object instantly to begin with, itween is for animation over time.  Simply set their transform position and you should be fine.

bye,

 Jean

andsee

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Any way to tell Playmaker to process a state machine now?
« Reply #2 on: September 20, 2012, 06:18:19 AM »
I'm using iTween to do a 'move from' which works well as it moves the object to an off screen position and then interpolates the object back to where it started.

However this is in material as I think issue is that the first state which gets executed from the global START transition is not run until after the screen has been updated. (I place a breakpoint on the state in playmaker and the screen is updated before it is hit) This to me implies that I can't do anything in playmaker to update this object before it's rendered.

I think this is because I am in unity's update loop which has called update on one of my mono behaviours which has in turn set the object with the playmaker fsm on it to active. In this scenario the Update() for that object is not called until the next frame. Instead I need to ensure that the state machine is executed as part of OnEnable so that it can update things before they are rendered. Be that via iTween or setting the transform  of the object.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Any way to tell Playmaker to process a state machine now?
« Reply #3 on: September 21, 2012, 01:37:32 AM »
Hi,


 Are you doing things in the Awake() method of the component?


bye,

 Jean