I have a VFX Graph that I turned into a prefab. I instantiate this prefab, and… nothing. Nothing happens at all. It doesn’t play, but it’s definitely in the hierarchy. It’s there, and I can click on it, and the window will pop up where I can hit “Play”, and it definitely plays.
It just refuses to play after being instantiated. What am I missing here? I’ve checked to make sure it’s not spawning off screen. The little VFX icon pops up in the scene view exactly where it’s supposed to. I’ve made sure my bounds are MASSIVE to make sure I can actually see it…
I completely started over with a new VFX Graph. I made it a prefab, and this time I did not attach a script to this prefab.
Now the particles do spawn upon instantiation.
I am beginning to suspect that if you try to access the VFX component and do anything with it, it somehow screws things up. I’m not positive yet, but this is all the info I have after hours of frustration…
If anyone else has any ideas as to what might be causing attached scripts to interfere with the particles actually playing, let me know. I just need to figure out how to set the play rate outside of a script…
It’s hard to tell without additional resources, but you should check if initial event name is correct (if you use it).
Also if this is related to the other thread you might have script with class name different than file name.
There is really small chance it’s caused by bugged vfx, so you can be 99% sure it’s fault of your setup.
It might be caused by long prewarm or it can be just spawning position, or you just changed play speed to 0.
None of those are correct in my case. File names are fine, prewarm was never touched, and I don’t use initial events (is that even a requirement?), and I never touched play speed (where would you do that outside of a script except in the inspector?).
As soon as I attach a script to a VFX prefab and try to access the prefab’s Visual Effects component, it stops working. If I remove the visualEffect = GetComponent<VisualEffect>(); line and stop accessing the component, it starts working again, but that leaves me stranded, as I cannot access anything to change
EDIT: Just to show you my script -
public class TestParticles : MonoBehavior
{
public VisualEffect visualEffect;
void Start()
{
visualEffect = GetComponent<VisualEffect>();
visualEffect.playRate = 300f;
}
}
As soon as I comment out that component line, boom. Starts working again.
Yes, that was my mistake - I wasn’t touching playspeed originally, but for some stupid reason, I had set it again after hours of working and didn’t realize*.*
Thank you. I was going crazy trying to figure this out. I don’t know why, but I think I had seen something in a Google search that had set the playRate value to these crazy high numbers, and in my brain I thought to myself “Hmm, 300… must mean 300%, right?”. Nope.
Anyhow, thanks again.
EDIT: What’s even worse is that I know playRate takes a float…