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. Dismiss Notice

FPS problems with error CS8025: Parsing error

Discussion in 'Scripting' started by matheus santos, Jun 18, 2014.

  1. matheus santos

    matheus santos

    Joined:
    Jun 18, 2014
    Posts:
    1
    Hi, I am new to script these things and I want you to help me in this error.


    Code (JavaScript):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class CubeGunBehaviour : MonoBehaviour {
    5.     public BulletBehaviour bullet ;
    6.  
    7.  
    8.     // Use this for initialization
    9.     void Start () {
    10.    
    11.     }
    12.    
    13.     // Update is called once per frame
    14.     void Update () {
    15.     if(Input.GetButtonDown("fire1")){
    16.             Instantiate(BulletBehaviour,Transform.position,Transform.rotation);
    17.     }
    18. }
    19.  
     
  2. zaxvax

    zaxvax

    Joined:
    Jun 9, 2012
    Posts:
    220
    remove { in the end of line 15 or add } in the end of line 16.
     
  3. Rutenis

    Rutenis

    Joined:
    Aug 7, 2013
    Posts:
    297


    Your code should look like this:


    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class Test : MonoBehaviour {
    6.  
    7. //Use Transform not BulletBehaiviour
    8.     public Transform bullet ;
    9.  
    10.  
    11.     // Use this for initialization
    12.     void Start () {
    13.      
    14.     }
    15.  
    16.     // Update is called once per frame
    17.     void Update ()
    18.     {
    19.         if(Input.GetButtonDown("fire1"))
    20.         {
    21. // transform.position, transform.rotation has to be lowercased not capitale;
    22.             Instantiate(bullet, transform.position,transform.rotation);
    23.         }
    24.     }
    25. }
     
    Magiichan likes this.
  4. Magiichan

    Magiichan

    Joined:
    Jan 5, 2014
    Posts:
    403
    Transform is the class, not an instance, so make sure that the "transform" is all lowercase.
     
    Rutenis likes this.