I have a VisualEffect that is used to represent a unit spawning. It seems to work fine in edit mode, but in play mode and builds it doesn’t play when it’s created/enabled, nor on ReInit(), Play, or SendEvent("OnPlay"). The initialEventName is the default "OnPlay".
HOWEVER, if I touch ANY of its settings in the inspector (even just toggling the “Initial Event Name” checkbox that doesn’t actually change anything), it will start playing. What’s more, if I save/compile the associated VFX asset while in play mode, ALL of the effects will start playing like they’re supposed to. Or, strangely, I can double click the Game window to maximize it which briefly brings up a “compiling shaders” bar, which also makes all of the effects start playing.
Here is the only code that references the VisualEffect, which happens whenever a unit begins to spawn from a structure:
constructingVFX.SetFloat("Progress", progress);
constructingVFX.SetVector4("Color", color);
constructingVFX.SetMesh("Mesh", mesh);
constructingVFX.transform.localPosition = new Vector3(spawnPoint.localPosition.x, spawnPoint.localPosition.y + mesh.bounds.size.y, spawnPoint.localPosition.z);
constructingVFX.enabled = true;
//constructingVFX.Reinit();
//constructingVFX.Play();
//constructingVFX.SendEvent("OnPlay");
yield return null;
while (warpInTimeElapsedSeconds <= totalWarpInTimeSeconds)
{
...
constructingVFX.SetFloat("Progress", progress);
constructingVFX.SetFloat("SpawnRate", progress * 4);
...
}
(The -1 progress isn’t the bug, it is updated during runtime. And it also plays the effect at a default speed when progress < 0.)

