Topic: [Bug Report] Basic move particle effects not spawning at same time

I was experimenting with landing particle effects and noticed that the effect would not spawn at the same time.
https://i.imgur.com/pDqzfko.gif
https://i.imgur.com/kuMe4xK.png

Share

Thumbs up Thumbs down

Re: [Bug Report] Basic move particle effects not spawning at same time

I see what is happening.
UFE has a special spawn system that works in conjunction with the netcode. To ensure optimal memory management, game objects stay alive in a spawn pool so they can be retrieved during rollbacks.
At the moment, particle effects spawn methods were designed with a weak unique id generator, and as a result, if the same particle gets spawned in the exact same frame by both players, this bug happens.

If you have UFE Source, here is a way to fix it:
Under MoveSetScript.cs, look for this line:

GameObject pTemp = UFE.SpawnGameObject(basicMove.particleEffect.prefab, newPosition, Quaternion.identity, Mathf.RoundToInt(basicMove.particleEffect.duration * UFE.config.fps));

And change it to this:

string uniqueId = basicMove.particleEffect.prefab.name + controlsScript.playerNum.ToString() + UFE.currentFrame;
GameObject pTemp = UFE.SpawnGameObject(basicMove.particleEffect.prefab, newPosition, Quaternion.identity, Mathf.RoundToInt(basicMove.particleEffect.duration * UFE.config.fps), false, uniqueId);
Like UFE? Please rate and review us on the Asset Store!
Questions about the Forum? Check out our Karma FAQ.
Don't forget to check our discord channel.

Re: [Bug Report] Basic move particle effects not spawning at same time

Tested those changes out, it works.
https://i.imgur.com/J7w0KPD.gif

Share

Thumbs up +1 Thumbs down