Hey Guys
I’m shooting a laser using a line renderer in code. So when I hit fire, I make two vertex points, set the beginning point and the end point, thats fine. But now that i’m trying to delete it I’m running into some problems. I have to set the vertices back to 0 when I want it to delete, so basically after I’ve fired in the update function is where I would put it would be my assumption. My code looks like this.
void Update ()
{
if(Input.GetButtonDown("Gamepad " + mannedPlayer + " RB") isRightTrigger == true)
{
if(isReloading == false)
{
renderLaser();
}
}
else
{
lineRenderer.SetVertexCount(0)
}
}
Now the problem with the above code, is that it deletes too quickly. I can’t figure out how to go about adding a delay to that properly to slow the update down. I’ve tried yield waitforseconds as well as Invoke. If anyone can figure out a good way to do this, that would be awesome.
Thanks