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);
}
}
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);
}
}
}
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
Follow this Question
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