Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Stakerauo · Feb 05, 2011 at 06:22 PM · syntax-errorcs1525burgzergarcade

error CS1525! having problems with Save scripts and following BurgZergArcade!

I were following BurgZergArcade on youtube when doing the "save character data" tutorial when I got an error sayin:

Assets/Scripts/GameSettings.cs(29,31): error CS1525: Unexpected symbol `PlayerCharacter'

this is what my scripts looks like:

CharacterGeneratorScript:

using UnityEngine; using System.Collections; using System; //used for the Enum class

public class CharacterGeneratorScript : MonoBehaviour { private PlayerCharacter _toon; private const int STARTING_POINTS = 350; private const int MIN_STARTING_ATTRIBUTE_VALUE = 10; private const int STARTING_VALUE = 50; private int pointsLeft;

 public GUIStyle myStyle;

 public GameObject playerPrefab;

 // Use this for initialization
 void Start () {
     GameObject pc = Instantiate(playerPrefab, Vector3.zero, Quaternion.identity) as GameObject;

     pc.name = "pc";

// _toon = new PlayerCharacter(); // _toon.Awake(); _toon = pc.GetComponent<PlayerCharacter>();

     pointsLeft = STARTING_POINTS;

     for(int cnt = 0; cnt &lt; Enum.GetValues(typeof(AttributeName)).Length; cnt++) {
         _toon.GetPrimaryAttribute(cnt).BaseValue = STARTING_VALUE;
         pointsLeft -= (STARTING_VALUE - MIN_STARTING_ATTRIBUTE_VALUE);
     }

     _toon.StatUpdate();
 }

 // Update is called once per frame
 void Update () {
 }

 void OnGUI() {
     DisplayName();
     DisplayAttributeText();
     DisplayVitalText();
     DisplaySkillText();
     DisplayPointsLeft();
     DisplayAttributes();
     DisplayVitals();
     DisplaySkills();
     DisplayCreateButton();

 }

 private void DisplayName() {
     GUI.Label(new Rect(10, 10, 50, 25), "Name:");
     _toon.Name = GUI.TextField(new Rect(65, 10, 200, 25), _toon.Name);
 }

     private void DisplayAttributeText() {
         GUI.Label(new Rect(10, 40, 60, 25), "Attributes:");
 }

     private void DisplayVitalText() {
         GUI.Label(new Rect(10, 255, 200, 25), "Vitals:");
 }

     private void DisplaySkillText() {
         GUI.Label(new Rect(10, 395, 150, 25), "Defence and Offence:");
 }

 private void DisplayAttributes () {
     for(int cnt = 0; cnt &lt; Enum.GetValues(typeof(AttributeName)).Length; cnt++) {
         GUI.Label(new Rect(10, 60 + (cnt * 25), 100, 25), ((AttributeName)cnt).ToString(), myStyle);
         GUI.Label(new Rect(115, 60 + (cnt * 25), 30, 25), _toon.GetPrimaryAttribute(cnt).AdjustedBaseValue.ToString());
         if(GUI.Button(new Rect(150, 60 + (cnt * 25), 25, 25), "-", myStyle)) {
             if(_toon.GetPrimaryAttribute(cnt).BaseValue &gt; MIN_STARTING_ATTRIBUTE_VALUE) {
                 _toon.GetPrimaryAttribute(cnt).BaseValue--;
                 pointsLeft++;
                 _toon.StatUpdate();
             }
         }
         if(GUI.Button(new Rect(180, 60 + (cnt * 25), 25, 25), "+", myStyle)) {
             if(pointsLeft &gt; 0) {
                 _toon.GetPrimaryAttribute(cnt).BaseValue++;
                 pointsLeft--;
                 _toon.StatUpdate();

             }
         }
     }
 }

 private void DisplayVitals() {
     for(int cnt = 0; cnt &lt; Enum.GetValues(typeof(VitalName)).Length; cnt++) {
         GUI.Label(new Rect(10, 100 + ((cnt + 7) * 25), 100, 25), ((VitalName)cnt).ToString(), myStyle);
         GUI.Label(new Rect(115, 100 + ((cnt + 7) * 25), 30, 25), _toon.GetVital(cnt).AdjustedBaseValue.ToString());
     }
 }

 private void DisplaySkills() {
         for(int cnt = 0; cnt &lt; Enum.GetValues(typeof(SkillName)).Length; cnt++) {
         GUI.Label(new Rect(10, 250 + ((cnt + 7) * 25), 100, 25), ((SkillName)cnt).ToString(), myStyle);
         GUI.Label(new Rect(115, 250 + ((cnt + 7) * 25), 30, 25), _toon.GetSkill(cnt).AdjustedBaseValue.ToString());
     }
 }

 private void DisplayPointsLeft() {
     GUI.Label(new Rect(300, 10, 100, 25), "Points Left: " + pointsLeft.ToString());
 }

 private void DisplayCreateButton() {
     if(GUI.Button(new Rect(400, 10, 110, 25), "Create Character", myStyle)) {
         GameSettings gsScript = GameObject.Find("_GameSettings").GetComponent&lt;GameSettings&gt;();

         //change the cur value of the vitals to the max modified value of that vital


         gsScript.SaveCharacterData();

         Application.LoadLevel("rpg first try");
     }
 }

}

And GameSettings:

using UnityEngine; using System.Collections; using System;

public class GameSettings : MonoBehaviour {

 void Awake() {
     DontDestroyOnLoad(this);
 }

 // Use this for initialization
 void Start () {

 }

 // Update is called once per frame
 void Update () {

 }

 public void SaveCharacterData() {
     GameObject pc = GameObject.Find("pc");

     PlayerCharacter pcClass = pc.GetComponent&lt;PlayerCharacter&gt;();

     PlayerPrefs.DeleteAll();
     GameObject pc = GameObject.Find("pc")

     PlayerCharacter pcClass = pc.GetComponent&lt;PlayerCharacter&gt;();

     PlayerPrefs.SetString("Player Name", pcClass.Name);

     for(int cnt = 0; cnt &lt; Enum.GetValues(typeof(AttributeName)).Length; cnt++) {
         PlayerPrefs.SetInt(((AttributeName)cnt).ToString() + " - BaseValue", pcClass.GetPrimaryAttribute(cnt).BaseValue);
         PlayerPrefs.SetInt(((AttributeName)cnt).ToString() + " - Exp To Level" , pcClass.GetPrimaryAttribute(cnt).ExpToLevel);
     }
     for(int cnt = 0; cnt &lt; Enum.GetValues(typeof(VitalName)).Length; cnt++) {
         PlayerPrefs.SetInt(((VitalName)cnt).ToString() + " - BaseValue" , pcClass.GetVital(cnt).BaseValue);
         PlayerPrefs.SetInt(((VitalName)cnt).ToString() + " - Exp To Level" , pcClass.GetVital(cnt).ExpToLevel);
         PlayerPrefs.SetInt(((VitalName)cnt).ToString() + " - Cur Value" , pcClass.GetVital(cnt).CurValue);
     }
 }

 public void LoadCharacterData() {
 }

}

Where did I go wrong ?? D':

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Peter G · Feb 05, 2011 at 06:49 PM

Make sure PlayerController.cs is compiled first.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Stakerauo · Feb 05, 2011 at 07:28 PM 0
Share

how can I do that when the game isnt done yet?? and I cant recall BurgZerg doing that in his videos

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Really Simple C# Errors I Can't Figure Out 1 Answer

Unexpected symbol `model' 4 Answers

errors with zxing barcode scanner 1 Answer

Error CS1519! Base Character script error from BurgZerg Arcade 2 Answers

error CS1525: Unexpected symbol `)' 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges