CASTON LYNCH

CASTON LYNCH

  • NA
  • 4
  • 2k

`Instantiate' does not exist in current context.

Dec 8 2017 3:42 PM
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)