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
3
Question by Obelixe · Jan 31, 2013 at 03:19 PM · animationmecanimtransitionstate machine

Why, when I delete transitions from the Animator State Machine, do I get a null reference exception?

After I have edited my animation state machine in the Animator Controller, I often get the following bug when playing my game. I think it is related to me deleting transitions from the animation state machine, but I can not get the bug to go away.

NullReferenceException: Object reference not set to an instance of an object UnityEditor.Graphs.AnimationStateMachine.TransitionInspector.OnEnable () (at /Applications/buildAgent/work/812c4f5049264fad/Editor/Graphs/UnityEditor.Graphs/AnimationStateMachine/TransitionInspector.cs:70)

Thanks!

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 Doireth · Jan 31, 2013 at 04:14 PM 0
Share

Have you any scripts referring to those deleted states?

avatar image Obelixe · Jan 31, 2013 at 04:21 PM 0
Share

I do not have any scripts referring to those deleted transitions or states. I only have 3 lines of script:

animator = GetComponent. . . .;
animator.SetFloat("V_Axis", Input.GetAxis("Vertical"));
animator.SetFloat("H_Axis", Input.GetAxis("Horizontal"));
Also, my animations are working correctly.

3 Replies

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

Answer by BrandonBradley · Feb 14, 2013 at 08:28 PM

I was getting this issue as well. I tried removing the Animation Controllers and recreating them (without ever creating any transitions). I applied the new controllers to my characters, but was still seeing this error.

What finally resolved it was to save my file, shut down Unity and then relaunch it. It seems the reference was cached in the IDE, and restarting allowed it to be cleared.

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 drawcode · Nov 14, 2013 at 02:41 AM 1
Share

Worked. $$anonymous$$ecanim animation editor seems to have a few other serialization issues... I was getting an m_Active bool error for the longest time from a param I added as a bool, removed, then added as a float before saving. Until I removed it, saved, closed, reopened, readded as just a float did it work. This is on a project upgraded from 4.2 to 4.3 so maybe a conversion issue. I save scene and project frequently due to prefab work but only shutting down fixed this null reference animation controller issue.

avatar image DannyB · Jan 31, 2014 at 04:54 PM 1
Share

Had the same issue, Unity 4.3.4. Only restart of Unity helped. Anyone reported a bug?

avatar image Traiger · Feb 09, 2014 at 03:18 PM 0
Share

SAme issue on 4.3.2...must update

avatar image Stardog · Mar 01, 2014 at 08:32 PM 0
Share

Same issue with 4.3.4. When messing with the Animation Controller and saving it, playing gives a random error in one of my GUI scripts (there are 0 actual errors with this small script). I commented those lines out and it gives only the error above. Restarting Unity fixes it, but then when changing the Animation Controller it bugs out again, requiring a restart.

$$anonymous$$y project was also upgraded from an older Unity version. Has anyone submitted a project to Unity bugs?

avatar image semih.guresci · Aug 06, 2015 at 01:25 PM 0
Share

I have the same issue with 5.1. Restart of unity and the computer did not work as well. Any recomendation?

Show more comments
avatar image
0

Answer by Doireth · Jan 31, 2013 at 04:25 PM

The line:

 animator = GetComponent();

Is your problem. The "GetComponent" call requires a component type to get. For example:

 animator = GetComponent(Animator);
Comment
Add comment · Show 8 · 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 Obelixe · Jan 31, 2013 at 04:28 PM 0
Share

No. I simply could not get the less than sign to show up in the forum post editor. This is not related to my Unity problem.

avatar image Doireth · Jan 31, 2013 at 04:32 PM 0
Share

Have you tried double-clicking on the error message in the editor console and see where it directs you?

avatar image Obelixe · Jan 31, 2013 at 04:41 PM 0
Share

It directs me to: Editor/Graphs/UnityEditor.Graphs/AnimationState$$anonymous$$achine/TransitionInspector.cs:70)

i.e. Not my code, but Unity's.

avatar image Doireth · Jan 31, 2013 at 04:47 PM 0
Share

Without more information about your state machines and how your script relates to it, there's little I can do to help.

avatar image Obelixe · Jan 31, 2013 at 04:51 PM 0
Share

I can happily send you everything as it is basically a tutorial project with Unity tutorial assets. How do I send it?

Show more comments
avatar image
0

Answer by percival49 · Jun 17, 2017 at 03:29 PM

What I did was I delete all the metadata in the assets folder library/metadata. That problem triggers when I untick the animator exit time, it throws the nullreferenceexception, I found restarting is a solution but the better way is deleting the metadata and then poof! The bug is gone.

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

17 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

Related Questions

Mecanim transition condition can't have both bool and trigger? 0 Answers

Mecanim state problem 1 Answer

What are those white curves in the animation transition panel - And can I read it in script? 0 Answers

Mecanim, Interrupting Transitions 1 Answer

Transition not keeping value after Play (bug?) 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