Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Network Animator throws NullReferenceException and doesn't let the game build.

Discussion in 'Netcode for GameObjects' started by AstroAxe, May 21, 2023.

  1. AstroAxe

    AstroAxe

    Joined:
    Jun 17, 2020
    Posts:
    3
    Hi, I want to syncronize my player animations over NGO, and I added to my visual the (owner) network animator but it does the same error with the normal network animator as well.
    upload_2023-5-21_14-6-42.png
    And when I try to build the game it throws these errors:
    upload_2023-5-21_14-7-21.png
    Any ideas? I was following CodeMonkeys recent tutorial on it..
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,533
    Make sure you use the same Unity and package versions as CodeMonkey did in the tutorial and if necessary, try starting over from scratch.

    Btw you can just copy/paste these console messages as text (select one or more lines, ctrl+c).
     
  3. AstroAxe

    AstroAxe

    Joined:
    Jun 17, 2020
    Posts:
    3
    Updated the versions but the problem still exists. But I don't understand why I get NullReferenceExceptions without running the code only when I click on the object that contains the Network Animator.

    NullReferenceException: Object reference not set to an instance of an object
    Unity.Netcode.Components.NetworkAnimator.BuildTransitionStateInfoList () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Components/NetworkAnimator.cs:276)
    Unity.Netcode.Components.NetworkAnimator.OnBeforeSerialize () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Components/NetworkAnimator.cs:307)
    UnityEditor.HostView:OnInspectorUpdate()
     
  4. AstroAxe

    AstroAxe

    Joined:
    Jun 17, 2020
    Posts:
    3
    The problem was that in my animator my states went into exit... But now I fixed it by going to other states directly