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

Having Trouble With C#

Discussion in 'Scripting' started by Rin-Kageyama, Mar 11, 2015.

  1. Rin-Kageyama

    Rin-Kageyama

    Joined:
    Mar 11, 2015
    Posts:
    9
    Hello. First post on these forums (duh)!
    I need help. I am coding for creating an RPG, and I am following the tutorial series here:


    This is the episode I am having trouble on. I follow everything perfectly, and I get two errors.

    1.) error CS1525: Unexpected symbol `}' On Line 8
    2.) error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement On Line 11 (Basically telling me that "public" is not expected there.)

    Here is my code:

    using UnityEngine;
    using Sytem.Collections;

    public class GameInfo : MonoBehavior

    void Awake() {
    DontDestroyOnLoad(transform.gameObject)
    } <--- Error here


    public static string PlayerName{get;set;} <----- Error here
    public static int PlayerLevel {get;set;}
    public static BaseCharacterClass PlayerClass{get;set;}
    public static int Endurance{get;set;}
    public static int Intellect{get;set;}
    public static int Strength{get;set}
    public static int Stamina{get;set;}

    }








    That is my code ^^^^ Sorry I didn't Copy&Paste, but for some reason, it came up as a bunch of asian symbols and smiley faces.

    Please help!!!
     
  2. A.Killingbeck

    A.Killingbeck

    Joined:
    Feb 21, 2014
    Posts:
    483
    DontDestroyOnLoad(transform.gameObject)....this line needs a ; at the end

    And you also need to enclose your class with { } brackets
     
  3. Niekos

    Niekos

    Joined:
    Mar 11, 2015
    Posts:
    8
    Just as a tip, you'd probably be better off learning some basic programming skills before you start making a game with a tutorial.
     
  4. Rin-Kageyama

    Rin-Kageyama

    Joined:
    Mar 11, 2015
    Posts:
    9
    Yeah, you're probably, no, certainly right.
    Do you know of any good courses or something I can take or something?
     
  5. Rin-Kageyama

    Rin-Kageyama

    Joined:
    Mar 11, 2015
    Posts:
    9
    Thank you so very much! Such a small thing. But that ; gets a lot of people, I'm sure. Such a minor thing, that has a huge impact!
     
  6. Roderyk

    Roderyk

    Joined:
    Mar 5, 2015
    Posts:
    75
    Search for any book that teachs C# for beginners. Read that, and follow the code. And practice.