playMaker

Author Topic: Create Object Glitch  (Read 1663 times)

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Create Object Glitch
« on: November 11, 2018, 02:04:30 PM »
Hello,

I'm noticing a type of glitch when creating an object (spawning) and was wondering if anyone has had similar experiences.

Each time an object is spawned the ones previously spawned will stutter (for lack of a better word or pause movement for a brief split second when another one is created).

A very simple setup.
Start State: Create Object, Transition Finished 
Wait For Next: Random Wait, Finish Event : Finished (Goes bak to the start state)
The Prefab Im spawning has a translate -2 in the X direction (different FSM).

Any suggestions on figuring out how to remove the Flicker when a new prefab is created? or why it may be happening?
Have I said how much I love playmaker!!! This is one amazing tool

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Create Object Glitch
« Reply #1 on: November 11, 2018, 04:52:41 PM »
Hi.
If you are spawning many object, you might want to use pooling.
Create/destroy are expensive(cpu)

A pooler will spawn a preset amount of object (best at the start of the game) and then activate when needed.
When deactivate they go back in the list so the can be reused later.

There is a simple pooling system package  on the Ecosystem called Pooler.

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Create Object Glitch
« Reply #2 on: November 11, 2018, 04:58:21 PM »
Instantiation is one of the most expensive functions in the engine, try avoiding it.
Available for Playmaker work

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Re: Create Object Glitch
« Reply #3 on: November 11, 2018, 05:12:41 PM »
I do intend to use pooling but when starting a new game I like to use create object to prototype first ;) but this time I got this strange effect.

It must have something to do with the collider because when I click Is Trigger the glitch effect is gone which is strange (thinking of scenarios when I need enemies with colliders, maybe it would be different if the collier is a child?). Anyway problem solved if cloudier is a trigger.

Appreciate the feedback on Pooling :D
 
Have I said how much I love playmaker!!! This is one amazing tool

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Re: Create Object Glitch
« Reply #4 on: November 11, 2018, 06:06:26 PM »
So the Is Trigger, or collider is not the issue, I removed the random wait and used the regular wait action and vice versa and believe this is where the glitch is coming from, how I have no idea...

Is there another way to create multiple objects without using the "Wait or Random Wait" I'm currently having them spawn every 1 to 2 seconds.
Have I said how much I love playmaker!!! This is one amazing tool

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Create Object Glitch
« Reply #5 on: November 12, 2018, 01:13:54 AM »
Hi,

 you'll need to profile, it's likely something in your prefab start routine, or maybe some assets that takes time to decompress ( like sound or texture)

Bye,

 Jean