• 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
6
Question by Jens Rasch · Jan 30, 2013 at 03:36 AM · nullreferenceexception

Finding the cause for a NullReferenceException

I get

 NullReferenceException: (null)
 UnityEditor.SerializedObject..ctor (UnityEngine.Object[] objs) (at C:/BuildAgent/work/812c4f5049264fad/Editor/MonoGenerated/Editor/SerializedPropertyBindings.cs:39)
 UnityEditor.AssetImporterInspector.GetSerializedObjectInternal () (at C:/BuildAgent/work/812c4f5049264fad/Editor/Mono/ImportSettings/AssetImporterInspector.cs:52)
 UnityEditor.Editor.get_serializedObject () (at C:/BuildAgent/work/812c4f5049264fad/Editor/MonoGenerated/Editor/EditorBindings.cs:71)
 UnityEditor.ModelImporterClipEditor.OnEnable () (at C:/BuildAgent/work/812c4f5049264fad/Editor/Mono/ImportSettings/ModelImporterClipEditor.cs:89)


None of the .cs files exists. How to find the cause?

Comment
Comments Locked · Show 10
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 schaddemm · Jan 30, 2013 at 03:54 AM 0
Share

You get that when? Is your installation intact?

avatar image Jens Rasch · Jan 30, 2013 at 04:25 AM 0
Share

what do you mean?

avatar image MountDoomTeam · Jan 30, 2013 at 02:36 PM 1
Share

we need more info about how you developed a program which provokes this error message within the default unity files- and what kind of code are you executing to get this error?

avatar image Jens Rasch · Jan 30, 2013 at 11:07 PM 0
Share

how you developed a program which provokes this error message

What do you mean?

avatar image Jens Rasch · Jan 30, 2013 at 11:08 PM 0
Share

what kind of code are you executing to get this error

a lot of code. As you see there are no line numbers in this error message.

avatar image Loius · Jan 30, 2013 at 11:38 PM 0
Share

What are the most recent things you did? New model asset imported? Changing meshes in-game/in-editor?

I've never seen or solved this myself, but it looks asset-related.

avatar image schaddemm · Jan 31, 2013 at 08:40 AM 0
Share
  1. try to see if your unity installation hasn't gone corrupt. try to get a different project to run. your getting errors from default unity files, which shouldn't ever be producing errors, so my first guess would be that your monoconfiguration got messed up somehow.

2.try to isolate the part of code thats producing the problem. at what point in your production progress did the problem appear? try to return the code to a prior working state and see at which point it stops working.

avatar image MountDoomTeam · Jan 31, 2013 at 09:05 AM 0
Share

did you write it yourself? your game? WTF is your game man! did you write any code, what does it do, what changes in your code made this error?

avatar image schaddemm · Jan 31, 2013 at 09:53 AM 0
Share

lol, we're slowly getting agitated, everyone really wants to find the nullreferenceexpection, and if the initial poster won't tell us we won't sleep well for days.

Asset-related sounds like a pretty good guess to me, like you calling some unityfunction to load a model but the model doesn't exist.

avatar image Doireth · Jan 31, 2013 at 04:12 PM 1
Share

The problem Jens is that those error messages pertain to the Unity editor and don't provide us with any real information.

We need to know things like when this started happening, what was changed around that time and are there any other errors occurring in-game or in the editor.

3 Replies

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

Answer by DaveA · Jan 31, 2013 at 04:38 PM

As schaddemm suggests, you should narrow down possible causes. 1. It looks like it's importing an animation clip from a model? Try deleting that model from your project (move it somewhere safe). Move all models. No more models? On to step 2: 2. Start removing code. If you can just disable scripts, do that. If scripts are necessary, start commenting out blocks of code. Eventually the error stops. Last thing you deleted was the culprit.

You may want to just start with and empty project and copy files into it until the error occurs, then you'll know what the culprit is anyway. Then we can try to figure out what the real problem is. Maybe you have a model with an empty animation key or something.

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

Answer by cregox · Apr 29, 2013 at 10:38 PM

In my case, restarting Unity was the only solution. No idea if something I did helped, but when I closed Unity and opened again, no more such errors could be found!

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 guneyozsan · Mar 04, 2017 at 01:37 PM 1
Share

I can confirm restarting Unity still solves this issue in 5.6.0b9

avatar image effx · Apr 05, 2017 at 07:37 PM 0
Share

I have this issue using 5.6.0f3 and solved it by restarting Unity as well.

avatar image zuritabal · Mar 11, 2018 at 07:54 PM 0
Share

is solved by restarting unity thx Unity 2017.3.1f1

avatar image
10

Answer by aitorrod · Aug 07, 2013 at 08:26 PM

I got the same error but was solved restarting the Unity IDE

Comment
Add comment · Show 6 · 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 tribio · Oct 31, 2013 at 05:58 PM 1
Share

Same problem, restarting Unity fixed! thanks!

avatar image zebishop · Jun 23, 2014 at 08:57 PM 5
Share

Had the same issue, restarting Unity also fixed it for me (Unity 4.5)

avatar image mpj · Jul 07, 2014 at 02:29 PM 6
Share

A simple restart of Unity solved this for me.

avatar image ritesh_khokhani · Apr 17, 2015 at 06:23 AM 0
Share

Simple and easy solution, take long breathe, restart unity and...You done it! Chill..

avatar image Manoj Balaji Mohan · Jan 12, 2016 at 10:02 AM 0
Share

had same issue, i am using unity 5.2, after restarting unity it fixed

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

29 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

Related Questions

NullReference in script? Prefab is linked in inspector 2 Answers

Gameobject not null at start but in function it is. 2 Answers

NullReferenceException by localRotation And Quaternion.Euler!?? 1 Answer

Null Reference Exception when using variable in another script 2 Answers

Scene Null Reference in build 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