Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unexpected symbol 'using'

Discussion in 'Scripting' started by Pepsidog, Mar 2, 2018.

  1. Pepsidog

    Pepsidog

    Joined:
    Apr 13, 2017
    Posts:
    28
    A script says "Unexpected symbol 'using'".
     

    Attached Files:

  2. In the gTime.cs:
    Code (CSharp):
    1. [Tooltip("Persistent Time. nUsePersistentTime :: 0 = Time of Day Time, 1 = Persistent Time")]
    2.  
    3.  
    4. using UnityEngine;
    5. using System.Collections;
    6. using System.Reflection;
    7. using gWeatherFunctions;
    8. using gDatabase;
    9. public int nUsePersistentTime = 1;
    10.  
    11. public class gTime : MonoBehaviour
    Tooltip and class member outside of the class. I think this is your problem.

    Also
    Code (CSharp):
    1.         //Added by Olander
    2.         void Start ()
    3.         {
    4.             //Get Time Data in _GameData
    5.             gTime = GameObject.Find ("_GameData").GetComponent<gTime>(); }
    6.         protected void FixedUpdate() {
    7.             //Progress Time or Not (via Server/Database)
    8.             //If not using this feature then comment out the 2nd line and Uncomment the 1st //bool ProgressTime = true;
    9.             bool ProgressTime = gTime.bTimeProgress;
    10.             //If Persistent Time is Enabled then Process Calculation if(nUsePersistentTime == 1)
    11.             {
    12.                 //From gFunctions.cs Persistent Time Controller DayLengthInMinutes = gTime.fDayLengthMinutes;
    13.                 sky.Cycle.Hour = gTime.fHourCurrent; sky.Cycle.Day = gTime.nDayCurrent; sky.Cycle.Month = gTime.nMonthCurrent; sky.Cycle.Year = gTime.nYearCurrent;
    14.             } else {
    15.             }
    16.         }
    You have commented out an 'IF' statement, but not the actual logic behind it.

    BTW, which script says unexpected using?
     
  3. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    Post the error verbatim and code with code tags - preferably the relevant code.
     
  4. Pepsidog

    Pepsidog

    Joined:
    Apr 13, 2017
    Posts:
    28
    Oops. That was actually pretty obvious. And the error appeared in gTime.cs.