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

Help! Unexpected symbol 'void' indexer class, struct or interface member declaration

Discussion in 'Scripting' started by Notarmaso, Nov 24, 2014.

  1. Notarmaso

    Notarmaso

    Joined:
    Oct 1, 2013
    Posts:
    13
    Why do I get this error? I think it is really wierd.
    Would love to get help on this one. Got a school deadline tommorow.
    Thanks!

    It says it on line 13.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class Inventory : MonoBehaviour {
    5.  
    6.     public static int charge = 0;
    7.     public AudioClip collectSound;
    8.     // HUD
    9.     public Texture2D[] hudCharge;
    10.     public GUITexture chargeHudGU
    11.  
    12.     // Use this for initialization
    13.     void Start () {
    14.         charge = 0;
    15.     }
    16.  
    17.     // Update is called once per frame
    18.     void Update () {
    19.  
    20.     }
    21.  
    22.     void CellPickup(){
    23.         AudioSource.PlayClipAtPoint(collectSound, transform.position);
    24.         charge++;
    25.         chargeHudGUI.texture = hudCharge[charge];
    26.     }
    27. }
    28.  
     
  2. Stoven

    Stoven

    Joined:
    Jul 28, 2014
    Posts:
    171
    You forgot to put a semicolon after chargeHudGU
     
    Notarmaso likes this.
  3. A.Killingbeck

    A.Killingbeck

    Joined:
    Feb 21, 2014
    Posts:
    483
    publicGUITexture chargeHudGU...you forgot a semi-colon
     
    Notarmaso likes this.
  4. Notarmaso

    Notarmaso

    Joined:
    Oct 1, 2013
    Posts:
    13
    Oh me..

    Thanks man!