Search Unity

Multiple VFX For One Object

Discussion in 'Visual Effect Graph' started by RoelYoon, Mar 7, 2022.

  1. RoelYoon

    RoelYoon

    Joined:
    Jan 25, 2021
    Posts:
    1
    Hi, I am fairly new at game development! I have created multiple VFX graphs for spells that can be cast by a player. However, I quickly found out that I cannot add more than one VFX component to a game object. I found a workaround by attaching these VFX components to empty prefab game objects and instantiating them at the player's position whenever a spell is used, but I don't think this method is the best. What would be the conventionally correct method for managing multiple VFX for one player object?
     
  2. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hi @RoelYoon ,

    You can nest multiple VFX Graphs within other VFXs as subgraphs. For example, you can have an empty VFX and add others within it:


    Then you can attach events to them, give them names, and then call from script SendEvent to trigger the ones you want:


    Depending on the number of effects and whether only the player will be casting them, there might be other approaches. For example if a particular spell occurs often within your level, you may consider having a master VFX for it that is not attached to the player or any NPCs, but instead using the SendEvent you also attach a position where you want that spell to spawn.

    Hope this helps!
     

    Attached Files:

    RoelYoon and Qriva like this.