- Home /
I can't solve this issue , please help
So I keep getting these errors: Helper.cs (74,17): error CS1041 : identifier expected Helper.cs (75,29): error CS1518 : Expected 'class', 'delegate', 'enum'or 'struct' Helper.cs (76,29): error CS8025 : Parsing error Helper.cs (76,29): error CS1038 : #endregion directive expected
Here's the script
#region Object Structures
public struct CameraTargetObject
{
private Vector3 position;
private Transform xForm;
public Vector3 Position;
{
get {return Position;}
**set** {Position = value;}
}
public **Transform** XForm
{
get(return xForm;)
set(xForm = value;)
}
public void Init(string camName, Vector3 pos, Transform transform, Transform parent)
{
position = pos;
xForm = transform;
xForm.name = camName;
xForm.parent = parent;
xForm.localPosition = Vector3.zero;
xForm.localPosition = position;
}
}
#endregion
#region public struct CameraMountPoint
{
private Vector3 position;
private Transform XForm;
public Vector3 Position;
{
get(return xForm;)
set(xForm = value;)
}
{
get { return position;}
set { Position = value;}
}
public void Init(string camName, Vector3 pos, Transform transform, Transform parent)
{
position = pos;
xForm = transform;
xForm.name = camName;
xForm.parent = parent;
xForm.localPosition = Vector3.zero;
xForm.localPosition = position;
}
}
#endregion
It also says Parser error : set and Transform
I fail to see why your question is more important than others, so update the title.
One of the problmes is at line 34
might be worth looking up a "hello world" in c#
http://msdn.microsoft.com/en-gb/library/aa288463(v=vs.71).aspx
Thanks guys, much appreciation. Just started working with Unity, Its still kinda hard for me , but I'm still learning. Couldn't figure this one out. Even though it was obvious for you pro's.
Again thanks, and have a nice day
Answer by 767_2 · Nov 07, 2014 at 11:45 AM
couple of problems , public struct CameraMountPoint
after #region public struct CameraMountPoint
and remove ** from the code and change your getter and setters to this format
public Vector3 Position {
get { return position ; }
set { position = value; }
}
the shorter version is better
public Vector3 Position { get; set; }
You copied the same error the OP has. The property is reading and writing itself. Using the getter or setter would cause a stack overflow.
Answer by Bunny83 · Nov 07, 2014 at 11:46 AM
Errors are:
line 11 / 12: You used the property name itself inside the property. It can't read / write itself. You probably want to use "position" instead of "Position". And of course without the "**". You can't make things bold in a code block, just for the future.
line 27: remove this line, it's useless.
line 34: You "regioned out" the header of your struct. Remove the
#region
in front of that line and move it into an empty line before that header.Line 40: This line is wrong here. Cut it out and move it down between the lines 44 and 45
line 40: Instead of the property you had there you probably want
public Transform XForm
in this line.line 42 / 43: You used the wrong brackets. You need
{ }
instead of( )
line 47: Again, you used the property itself inside the setter.
line 57: Again, useless line.
Your answer
Follow this Question
Related Questions
c# parsing error Help please and the error is at where it says public string Name 1 Answer
CS8025 Error (Parsing Error) 1 Answer
I keep getting CS8025 parsing error 1 Answer
CS8025 Parsing error 3 Answers
CS8025 parsing error 1 Answer