Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Using spell beam vfx in game

Discussion in 'Visual Effect Graph' started by Nova8808, Apr 13, 2020.

  1. Nova8808

    Nova8808

    Joined:
    Aug 3, 2013
    Posts:
    7
    I created a constantly emitting line of particles (like a magic beam or laser beam) in vfx graph. I'm trying to get it to shoot from my player when left mouse is down. It will say the visual effect is spawned but I dont see anything. Any ideas? (See attached code) I assume with this code it may shoot out from a location and I will need to attach it so it moves with the player but first i'm just trying to get it to show something.

    Code (CSharp):
    1.  public VisualEffect currentvfx;
    2.  
    3. if (Input.GetMouseButtonDown(0))
    4. {
    5. currentvfx = Instantiate(currentvfx, transform.position, transform.rotation) as VisualEffect;
    6.  
    7. currentvfx.Play();
    8. }
     
  2. Nova8808

    Nova8808

    Joined:
    Aug 3, 2013
    Posts:
    7
    I can see it now. I believe it was just some weird camera clipping issue since I can see it now but at some angles it disappears.

    It may also be related to a TRSmatrix error i'm getting regarding the visual effect.

    Update: TRSmatrix error is related to turbulence effect.
     
    Last edited: Apr 14, 2020
  3. VladVNeykov

    VladVNeykov

    Unity Technologies

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

    The VFX is only rendered is its bounds are within the camera frustum. You can either set the bounds Size to be much larger, or you can update the Center of the box to match the position of your Main Camera, target, or whatever other position you know will always be seen:
    upload_2020-4-13_16-44-25.png

    Hope this helps!
     
    Nova8808 likes this.