question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unusual Error in version 1.5.1

See original GitHub issue

Description

Project fails to compile after updating to 1.5.1

Reproduce Steps

Update to version 1.5.1

Actual Outcome

Receive a code generation error (Looks related to that null ref check that was added)

Expected Outcome

Project works

Screenshots

Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP: (0,0): error - System.NullReferenceException: Object reference not set to an instance of an object.|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.GenerateVariableInitialization(TypeDefinition type)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.GenerateVariableInitialization(TypeDefinition type)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.ProcessNetworkBehaviour(TypeDefinition typeDefinition, String[] assemblyDefines)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.<>c__DisplayClass7_0.<Process>b__1(TypeDefinition b)|| at System.Collections.Generic.List1.ForEach(Action1 action)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.Process(ICompiledAssembly compiledAssembly) at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.GenerateVariableInitialization(TypeDefinition type)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.GenerateVariableInitialization(TypeDefinition type)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.ProcessNetworkBehaviour(TypeDefinition typeDefinition, String[] assemblyDefines)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.<>c__DisplayClass7_0.<Process>b__1(TypeDefinition b)|| at System.Collections.Generic.List1.ForEach(Action1 action)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.Process(ICompiledAssembly compiledAssembly)

Environment

  • OS: Windows
  • Unity Version: 2022.3.0
  • Netcode Version: 1.5.1

Additional Context

Really sorry about the super short bug report. My team is on a very tight deadline right now, so I only had 30 min to tests the new netcode version update. Hopefully what I posted above is helpful!

Issue Analytics

  • State:closed
  • Created 3 months ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
deogocommented, Jun 29, 2023

for those who are struggling, here is solution. The trick is to not use Generic type variables

public class SingletonNetwork<T> : NetworkBehaviour where T : NetworkBehaviour
{
    private static NetworkBehaviour _instance;
    public static T Instance { get => _instance as T; }

    public virtual void Awake()
    {
        if (_instance == null)
        {
            _instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
    }
}

public class Derived : SingletonNetwork<Derived>
{
    private void Start()
    {
        var v = Derived.Instance;
    }
}
0reactions
Nakoucommented, Jun 29, 2023

I confirm the same regression. since Unity 2022.3.4f doesn’t let you chose the 1.4 version in the package manager, you can downgrade your version of NGO by changing "com.unity.netcode.gameobjects": "1.5.1", to "com.unity.netcode.gameobjects": "1.4.0", in your ProjectName/Packages/manifest.json

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stalker Anomaly 1.5.1 (DirectX error?)
I cant run Stalker Anomaly 1.5.1 its my first experience with this mod,i played Call of Chernobyl with 8 mods and everything was...
Read more >
iDeneb 1.5.1 on T61 strange error on bootloader
The error seems to be on the bootloader (Chameleon v2) post installation activity. I try to install it on a HD totally dedicated...
Read more >
unable to resolve dependency tree error for creating new ...
Open the folder you create with ng new and open the package.json file. In devDependencies change the version of "jasmine-core" 3.6.0 to ...
Read more >
Plan failures with terraform 1.5.0 and framework 1.2.0
Terraform 1.4.6 works with my provider, but 1.5.0 does not. The error is: │ Error: Provider produced invalid plan │ │ Provider ...
Read more >
venv created by poetry seems to 'hide' pip resulting in ...
Poetry Version: 1.5.1 Python: 3.11.0 Virtualenv Python: 3.11.3 ... seems to 'hide' pip resulting in mixed languages error message and weird characters.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found