Instantiating Prefab, Name Does Not Exist In This Context

I’m following an online stream which has been really helpful, however I’m encountered a problem which the guy didn’t have.

The live stream is here: 4 Hours of Making C#Shooter! From Nothing to a Game [Unity3D Livestream] - YouTube

My issue is with this one line of code:

if (Input.GetButtonDown("Fire1"))
			{ Instantiate(PlayerLaser, transform.position + Vector3(0f, 0f, 0.5f), transform.rotation)
				; }

The error I’m getting is that I the name doesn’t exist in this context, however I do have a prefab called PlayerLaser. Any ideas on what I’m missing?

Thanks.

1 Answer

1

Sorry guys!

Feeling a little stupid now. Forgot to actually create a GameObject variable…