playMaker

Author Topic: most performant way to use a giant pile of scripts  (Read 778 times)

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
most performant way to use a giant pile of scripts
« on: March 06, 2022, 05:12:03 AM »
Hello. I have a _SYS game object, with a hundred billion jillion children, each with its own fsm (movement, jumping, inventory, etc.).
Is it more performant to leave the game object or fsms active at all times, or should they be enabled and disabled after they are called each time? could it cause lag spikes enabling a bunch of them at once?

an example is the menu system. should its game object or fsm be disabled when the menu is closed? or should it just go to a listener state and wait until called again?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7624
    • jinxtergames
Re: most performant way to use a giant pile of scripts
« Reply #1 on: March 08, 2022, 01:31:17 PM »
Hi.
i think it kind of depends what you have on those fsms

for example if you would enable a whole bunch of objects/fsms with a raycast on the start state (in the same frame) , you would get lag spike.

in our game for menu stuff its disabled (object) when not in use and we have 1 object/fsm to listen if the menu button is pressed, but main reason is to turn of canvas