1
Answer

`Instantiate' does not exist in current context.

CASTON LYNCH

CASTON LYNCH

6y
222
1
Hello! I am currently in a game design class using Unity 5.6.1, and I'm working on a script for a cube that shoots out a capsule as a bullet-style weapon. A piece of the code I have is as shown below:
 
      void FixedUpdate()
      {
            if (Input.GetButton ("Fire1") && Time.time > nextFire)
            {
                  nextFire = Time.time + fireRate;
                  Instantiate(shot, shooter.position, shooter.rotation);
            }
      }
 
 However, on the Instantiate line, I'm getting the error "The name `Instantiate' does not exist in the current context". Can someone help me out or tell me what I'm doing wrong? Attached is a picture of the whole script if that helps at all.
 
 
Answers (1)