playMaker

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

coggia

  • Playmaker Newbie
  • *
  • Posts: 11
    • View Profile
best pratice to update FSM vars?
« on: April 24, 2018, 06: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: 13001
  • Official Playmaker Support
    • View Profile
Re: best pratice to update FSM vars?
« Reply #1 on: April 24, 2018, 08: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
    • View Profile
Re: best pratice to update FSM vars? [SOLVED]
« Reply #2 on: April 24, 2018, 11:38:47 AM »
okay thanks, I'll change my logic :)