playMaker

Author Topic: best pratice to update FSM vars?  (Read 6146 times)

coggia

  • Playmaker Newbie
  • *
  • Posts: 11
best pratice to update FSM vars?
« on: April 24, 2018, 09:33:22 AM »
Hello everyone,
I'm just wondering if there isn't a best way to find updated fsm values than to put the declaration in the update loop?

If i want to check if at anytime if an FsmBool is true like this :
Code: [Select]
FsmBool isMoving = MyFsm.FsmVariables.FindFsmBool("isMoving").Value;do I always have to put it in an update() loop?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15594
  • Official Playmaker Support
Re: best pratice to update FSM vars?
« Reply #1 on: April 24, 2018, 11:30:28 AM »
Hi,

 A better way is to only get it when you need it, instead of every update.

 and if you cache the Fsmbool in a private variable, and find the fsmbool once, and then get its value on update, it will be a lot more performant and totally fine actually.


 Bye,

 Jean

coggia

  • Playmaker Newbie
  • *
  • Posts: 11
Re: best pratice to update FSM vars? [SOLVED]
« Reply #2 on: April 24, 2018, 02:38:47 PM »
okay thanks, I'll change my logic :)