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 KronoZ · Nov 07, 2014 at 11:10 AM · errorcs8025

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

Comment
Add comment · Show 3
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 Linus · Nov 07, 2014 at 11:27 AM 0
Share

I fail to see why your question is more important than others, so update the title.

One of the problmes is at line 34

avatar image bubzy · Nov 07, 2014 at 11:40 AM 0
Share

might be worth looking up a "hello world" in c#

http://msdn.microsoft.com/en-gb/library/aa288463(v=vs.71).aspx

avatar image KronoZ · Nov 07, 2014 at 12:11 PM 0
Share

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

2 Replies

· Add your reply
  • Sort: 
avatar image
-1
Best Answer

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; } 


Comment
Add comment · Show 4 · 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 Bunny83 · Nov 07, 2014 at 11:47 AM 0
Share

Did you actually read your code snippet?

avatar image 767_2 · Nov 07, 2014 at 12:05 PM 0
Share

what do you mean

avatar image Bunny83 · Nov 07, 2014 at 12:20 PM 0
Share

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.

avatar image 767_2 · Nov 07, 2014 at 12:40 PM 0
Share

it was a typo

avatar image
0

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.

Comment
Add comment · 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

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

6 People are following this question.

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

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


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