Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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
1
Question by FabulaLeonis · Jul 06, 2015 at 08:49 AM · c#crashsingletonserializablemember

Crash when using "Base" as member... is it a reserved word ?

Hello,

I am encountering today a quite bizarre issue, and also quite specific.

When using "Base" as member name (Base being a Serializable class) within a Singleton (using the classic c# singleton implementation), Unity crashes (when saving/loading the scene).

I know "base" is a reserved word, but is "Base" as well? What am I missing ?

To reproduce:

  • create a Singleton

  • in this singleton, create a "public TestClass Base;"

  • TestClass is defined as:

     [System.Serializable]
         public class testclass
         {
             public int stuff;
         }
    
    
    

Notes:

  • No crash if with another member name (such as "TheBase")

  • No crash outside of a Singleton either (although the Singleton doesn't use any "Base")

  • No crash if Base is defined as an int (for instance) rather than a Serializable custom class

Thanks

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 Cherno · Jul 06, 2015 at 09:42 AM

A quick google search only brought up the word "base" as a keyword.

Comment
Add comment · Show 3 · 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 FabulaLeonis · Jul 06, 2015 at 09:44 AM 0
Share

Yes, "base" (low case) is a reserved word in c# for sure.

I can't find the correlation with "Base" (PascalCase) though... and crashing only in this specific conditions.

avatar image AlwaysSunny · Jul 06, 2015 at 10:01 AM 0
Share

Can't speak to the reason for this specific issue; there are several magic words you can't or probably shouldn't use in any language / API. An alternate capitalization of a keyword definitely falls into the later category; evidently, in this case, the former as well.

avatar image FabulaLeonis · Jul 06, 2015 at 02:40 PM 0
Share

Still, I would have expected something to catch the issue (auto completion, compiling error or warning...), be less intricate in the repro steps, not to mention the IDE crash...

Leaving this here, if anyone has a suggestion for this mystery.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Game doesnt start after adding Admob 1 Answer

Singleton implementation 1 Answer

Where would I call the DoDestroyOnLoad function on my Singleton Script 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