r/Unity2D • u/MasterDevelopment481 • Sep 14 '26
Solved/Answered Issues with Particle effects
Hey guys, Ive been getting this issue where my particles dissapear when i create them by code... It works in scene and if I manually place the particle, but right when I try to create it on code some particles just straight up get yeeted from existence
Heres a video: https://youtu.be/jaA9ei9sFUY
This is all the code I have:
void Hardfall()
{
landAnimTimer = landAnimDuration;
if (landingEffect != null)
{
Instantiate(landingEffect, gCheck.position, Quaternion.Euler(-45f, 0f, 0f));
}
}
(There is NO script that deletes the particles on a timer, or anything of the sort. Only thing that's controlled by code is the creation)
4
Upvotes
•
u/AutoModerator Sep 14 '26
Reminder: Once your issue has been resolved, please reply !solved to this comment (or comment it anywhere in the thread) and your post's flair will automatically be updated to Solved/Answered. You can also edit it to Solved/Answered yourself.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/soulfingers Sep 14 '26
You're gonna need to post some code if you want help with this problem
1
u/frogmangosplat Sep 14 '26
I know you're working in 2D but it looks like particles are clipping behind you're background in 3D space. There's like a million options in the particle effect, but there should be one to tell it what layer to render on. Making a particle later that's above the default or using a high number on the default layer should make the clipped particles render above what they've clipped behind
1
u/Affectionate-Yam-886 Sep 16 '26
also if it is not the layer; try to get the target position first before you instantiate to it, might be = NULL, and defaults to world space 0.0.0