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

Problem with a script

Discussion in 'Scripting' started by Storm-ace, May 2, 2016.

  1. Storm-ace

    Storm-ace

    Joined:
    Sep 3, 2015
    Posts:
    13
    Gamer To Game Developer course.

    Hi guys i have a odd problem that i can't see to fix when watching the course.

    Member modifier public must precede the member type and name.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;SetInitialRefences
    3.  
    4.    public class TriggerExample : MonoBehaviour {
    5.  
    6.     private WalkTroughWall walkTroughWallScript;
    7.    
    8.     void Start()
    9.     {
    10.         SetInitialRefences();
    11.     }
    12.  
    13.  
    14.     void OnTriggerEnter(Collider other)
    15.     {
    16.         //Debug.Log(other.name + " has entered");
    17.         walkTroughWallScript.SetLayerNotSolid();
    18.     }
    19.  
    20.     void OnTriggerExit(Collider other)
    21.     {
    22.         //Debug.Log(other.name + " has exited");
    23.         walkTroughWallScript.SetLayerToDefault();
    24.     }
    25.  
    26.     //void OnTriggerStay(Collider other)
    27.     //{
    28.     //    //Debug.Log(other.name + " is in the trigger");
    29.     //}
    30.  
    31.     void SetInitialRefences()
    32.     {
    33.         if(GameObject.Find("Wall")!= null)
    34.         {
    35.             walkTroughWallScript = GameObject.Find("Wall").GetComponent<WalkTroughWall>();
    36.         }
    37.         else
    38.         {
    39.             Debug.Log("Object is net setup right.");
    40.         }
    41.        
    42.     }
    43. }
    44.  
     
  2. KD_W

    KD_W

    Joined:
    Feb 9, 2015
    Posts:
    19
    using System.Collections;SetInitialRefences

    Try delete SetInitialRefences
     
    Storm-ace likes this.
  3. Storm-ace

    Storm-ace

    Joined:
    Sep 3, 2015
    Posts:
    13
    Thank u so much seems like i have a lot to learn when it comes to reading errors :)