Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question Spawning vfxGraphs and particle Systems

Discussion in 'Graphics for ECS' started by shotoutgames, Mar 24, 2024.

  1. shotoutgames


    Dec 29, 2013
    What's the best / correct method / workaround?
    I am fine spawning prefabs as entities but I don't have a clear method in my head on how to access the managed objects components.
    Code (CSharp):
    1.    //pass  this to playermove mb and set VFX effect there - for some reason if set in Sub-Scene it ignores parameters
    2.         AddComponentObject(GetEntity(authoring, TransformUsageFlags.None),
    3.             new PlayerMoveGameObjectClass(authoring.AudioSource)
    4.             {
    5.                 name =,
    6.                 clip = authoring.AudioClip,
    7.                 vfxSystem = authoring.vfxPrefab
    8.             }

    then system

    Code (CSharp):
    2.                         if (playerMove.vfxSystem)
    3.                         {
    4.                             playerMove.vfxSystem.GetComponent<VisualEffect>().SetFloat("FlareRate", 40);
    5.                             Debug.Log("Flare Rate 40 ");
    6.                         }
    I get no errors but the changes to the Spawn Rate have no effect event though I can change the cloned object properties from the scene.

    Thanks for any feedback