Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 GlorifiedPig · Jun 03, 2018 at 05:18 PM · integerdouble64bit32bitlong

Any number that exceeds 32 bits crashes game

I've tried using a long, I've tried using a double, I've even tried using an Int64, but if my number exceeds the 32-bit integer limit, my game crashes. I've tried debugging it but there are no crash logs appearing. I have literally removed every single reference to the number and only put it to equal like 5 billion on startup but it still crashes my game. Is there something I need to tweak in the player settings or how do I get rid of this issue?

Comment
Add comment · Show 12
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 Tobychappell · Jun 03, 2018 at 05:26 PM 0
Share

Is this set in code like, int x = 5000000000; or via inspector?


If so, could you provide the exact line of code?

avatar image GlorifiedPig Tobychappell · Jun 03, 2018 at 05:31 PM 0
Share

In the code.

 void Start() {
     cash = 5000000000;
 
     LoadGame();
     InvokeRepeating( "CountTimePlayed", 1.0f, 1.0f );
     InvokeRepeating( "SaveGameTimer", 15.0f, 15.0f );
     InvokeRepeating( "CheckForLevelUp", 5.0f, 15.0f );
 }
avatar image Tobychappell GlorifiedPig · Jun 03, 2018 at 06:14 PM 0
Share

I cant seem replicate this. I did: long xl = 5000000000;

And i built the game against both x86 and x86_64 and both built and ran without crashing.

Is your operating system 32bit?

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Bunny83 · Jun 04, 2018 at 02:04 AM

Ok, just to clear some confusion here:

  • First of all the type long is just an alias for the type System.Int64. So they are literally the same type and there will be no difference using long or Int64.

  • The type long works even on 32bit architectures / operating systems. It is just a signed number type with 64 bits. Just like the type decimal which has 128 bits and works on 32bit hardware / software

  • setting a long variable to any kind of value will never crash or hang your application.


It's not clear what you mean by crash. In most cases you do not experience a crash but a hang which is a quite different thing. If your application hangs in almost all cases you have some kind of infinite loop. Do not concentrate on the setting of the value but on where you use it.


We can't help you any further without more information. All i can say i've used longs, and ulongs in 32 / 64 standalone build as well as android or webGL builds without any problems. And yes, my values did exceed the 32 bit border, otherwise i wouldn't have used a long in the first place. So if you want further help edit your question and include your code.

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 GlorifiedPig · Jun 04, 2018 at 06:45 AM 0
Share

Thanks a lot for your help. Turns out I had a function to include the maximum amount of upgrades you can fit into the amount of cash you have, and that number was a regular integer and exceeded 32 bits, so it hanged the game.

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

85 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Editor crash after editing in a better computer 0 Answers

32bit and 64 bit plugin environment 1 Answer

Idle Game Currency Optimizing 1 Answer

Problems with 64-bit systems 0 Answers

Can 32bit Unity editor make 64bit games? 0 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