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 /
  • Help Room /
avatar image
0
Question by DelphinusGames · Jan 07, 2013 at 06:39 PM · errorloadparsing

CS8025 Parsing error!?

(58,1): error CS8025: Parsing error

If any one can fix please help!

 using UnityEngine;
 using System.Collections;
 using System.Xml;
 using System.Xml.Serialization;
 using System.IO;
 using System.Text;
 
 public class Load: MonoBehaviour {
 // This is our local private members
 Rect _Save, _Load, _SaveMSG, _LoadMSG;
 bool _ShouldSave, _ShouldLoad,_SwitchSave,_SwitchLoad;
 string _FileLocation,_FileName;
 public GameObject _Player;
 UserData myData;
 string _PlayerName;
 string _data;
 Vector3 VPosition;
 
 void Start () { // We setup our rectangles for our messages
 
   _Load=new Rect(10,100,100,20); 
 
   _LoadMSG=new Rect(10,140,400,40); 
 
   // Where we want to save and load to and from 
   _FileLocation=Application.dataPath; 
   _FileName="SaveData.xml"; 
 
   // for now, lets just set the name to Joe Schmoe 
   _PlayerName = "Player1"; 
 
   // we need soemthing to store the information into 
   myData=new UserData(); 
 
 }
 
 void Update () {}
 
 void OnGUI() {
     //*************************************************** // Loading The Player... // **************************************************
     if (GUI.Button(_Load,"Load"))
     { 
       GUI.Label(_LoadMSG,"Loading from: "+_FileLocation); 
       // Load our UserData into myData 
       LoadXML(); 
 
          if(_data.ToString() != "") 
          { 
          // notice how I use a reference to type (UserData) here, you need this 
          // so that the returned object is converted into the correct type 
          myData = (UserData)DeserializeObject(_data); 
          // set the players position to the data we loaded 
          VPosition=new Vector3(myData._iUser.x,myData._iUser.y,myData._iUser.z);              
          _Player.transform.position=VPosition; 
          // just a way to show that we loaded in ok 
          Debug.Log(myData._iUser.name); 
          } 
 }
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 Landern · Jan 07, 2013 at 06:46 PM

Well first, Edit your code and use the 1010101 button after highlighting your code.

Is the "using http://System.IO;" line really there? If so it should be:

 using System.IO;

If you are getting an error on a particular line, you should really post that. If so it will help(after you format your code) to locate the real error.

Anyways, here is your code, which was missing curly braces and the update method was all dorked up...

 using UnityEngine;
 using System.Collections;
 using System.Xml;
 using System.Xml.Serialization;
 using System.IO;
 using System.Text;
 
 public class Load: MonoBehaviour {
 // This is our local private members
 Rect _Save, _Load, _SaveMSG, _LoadMSG;
 bool _ShouldSave, _ShouldLoad,_SwitchSave,_SwitchLoad;
 string _FileLocation,_FileName;
 public GameObject _Player;
 UserData myData;
 string _PlayerName;
 string _data;
 Vector3 VPosition;
 
 void Start () { // We setup our rectangles for our messages
 
   _Load=new Rect(10,100,100,20); 
 
   _LoadMSG=new Rect(10,140,400,40); 
 
   // Where we want to save and load to and from 
   _FileLocation=Application.dataPath; 
   _FileName="SaveData.xml"; 
 
   // for now, lets just set the name to Joe Schmoe 
   _PlayerName = "Player1"; 
 
   // we need soemthing to store the information into 
   myData=new UserData(); 
 
 }
 
 void Update () {}
 
 void OnGUI() {
     //*************************************************** // Loading The Player... // **************************************************
     if (GUI.Button(_Load,"Load"))
     { 
       GUI.Label(_LoadMSG,"Loading from: "+_FileLocation); 
       // Load our UserData into myData 
       LoadXML(); 
 
           if(_data.ToString() != "") 
           { 
             // notice how I use a reference to type (UserData) here, you need this 
             // so that the returned object is converted into the correct type 
             myData = (UserData)DeserializeObject(_data); 
             // set the players position to the data we loaded 
             VPosition=new Vector3(myData._iUser.x,myData._iUser.y,myData._iUser.z);              
             _Player.transform.position=VPosition; 
             // just a way to show that we loaded in ok 
             Debug.Log(myData._iUser.name); 
           } 
 }

}

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 Roboticenderman · Apr 05, 2017 at 05:52 PM 0
Share

I have the same error - here is my script. Please help

pragma strict

/the grenade to use var granade:GameObject; //the point to throw the grenade var ThrowPoint:Transform; //the amount of force we want to pust it forward var ForwardThrowForce:float; //the amount of force we want to push it up var UpwardThrowForce:float;

//if you press the right mouse button //creates the granade at the throw point //turns it on //then adds the force to push it up and forward //note you must use AddRelativeForce this adds force to the grenade in non world space function Update () { if(Input.GetButtonDown("Fire2")){ var expode:GameObject; expode=Instantiate(Grenade,transform.position,transform.rotation); expode.transform.position=ThrowPoint.transform.position; expode.transform.rotation=ThrowPoint.transform.rotation; expode.SetActive(true); expode.GetComponent.().AddRelativeForce(0,UpwardThrowForce,ForwardThrowForce,Force$$anonymous$$ode.Impulse); } }

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

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

I "m having some issues . How do I get the don't destroy on load to work in C# ? 0 Answers

How To Fix Parsing Errors 1 Answer

error when login 0 Answers

Help with my Arrow Fire Script 1 Answer

Scene IS added to build settings: "Scene couldn't be loaded because it has not been added to the build settings" 7 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