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 litebox · Mar 29, 2016 at 03:21 PM · iosil2cppruntime-error

IOS IL2CPP runtime error​ NullReferenceException

Hi all, currently I'm working on update for my old game. Previously I compiled it with Unity 5.0.x with Mono2x and all was good. Currently I'm trying to compile it with Unity 5.3.4f1 with IL2CPP (iOS Universal Architecture) and at run-time I'm getting 2 errors:

 ​
 NullReferenceException: A null value was found where an object instance was required.
 at PauseMenu.endGameButtonClick () [0x00000] in <filename unknown>:0
 (Filename: currently not available on il2cpp Line: -1)
 NullReferenceException: A null value was found where an object instance 
 was required.
 at PlayerController..ctor () [0x00000] in <filename unknown>:0
 (Filename: currently not available on il2cpp Line: -1)
 NullReferenceException: A null value was found where an object instance was required.
 at PlayerController..ctor () [0x00000] in <filename unknown>:0
 (Filename: currently not available on il2cpp Line: -1)


PauseMenu.endGameButtonClick references to button's click callback, and I don't call it at all (If I delete this function I got another similar error, references to another button callback from this PauseMenu C# script)

Second error logs at every frame update (I have tried to delete Update and FixedUpdate from my PlayerController, but this was not help)

Meanwhile I made Android build with Mono2x and it working good.

Comment
Add comment · Show 2
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 JoshPeterson · Mar 30, 2016 at 12:55 PM 0
Share

I'm not sure about the exact cause of the error, but I can point you to a few resources to help track it down:

IL2CPP INTERNALS – DEBUGGING TIPS FOR GENERATED CODE (blog post)

IL2CPP: Profiling and Debugging (video)

Both of these resources discuss specifically how to debug the generated C++ code in Xcode to track down the cause of an exception.

Initially, I would suspect that something is wrong with the code stripping in this case, as that is a key difference between the $$anonymous$$ono and IL2CPP build toolchains. The IL2CPP toolchains more aggressively strips managed code in assemblies in your project. So whatever is causing the null value may have been stripped away.

avatar image litebox JoshPeterson · Mar 31, 2016 at 07:50 AM 0
Share

Thanks for links, yes, I also thought about code stripping and disable it, but the error was much more simpler, just null transform I use at specific platform only

1 Reply

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

Answer by litebox · Mar 30, 2016 at 01:04 PM

After disabling / enabling parts of scene and comment / uncomment parts of PauseMenu class I finally found a problem:

 if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
 copyrightTransform.gameObject.SetActive(false);

All is simple, this object was null. Unfortunately IL2CPP doesn't provide exact place of problem, instead of this it references to random parts of class and this is confusing even more.

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 JoshPeterson · Mar 30, 2016 at 01:07 PM 0
Share

I'm not following sorry. Is the managed call stack provided by IL2CPP incorrect? Did the NullReferenceException occur in a different method from Pause$$anonymous$$enu.endGameButtonClick?

avatar image litebox JoshPeterson · Mar 31, 2016 at 11:23 AM 0
Share

Yes, NullReferenceException occurs at Pause$$anonymous$$enu::Start() method

avatar image JoshPeterson litebox · Mar 31, 2016 at 11:26 AM 0
Share

Can you provide this project with a bug report? The call stack in the exception should be correct. I would like to investigate why it is wrong.

Show more comments

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

.net socket disconnection exception 0 Answers

Unity Build IOS XCODE build error ReentrantLock 0 Answers

IOS build size using IL2CPP 1 Answer

Unity www class crashes on iOS 64 bit 2 Answers

Build error with IL2CPP 3 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