hello I’ve been fighting with this exception for days. I’ve also started with the version change for gameobject from com.unity.netcode.gameobjects@1.0.0-pre.9 to com.unity.netcode.gameobjects@1.0.0-pre.8, com.unity.netcode.gameobjects@1.0 .0-pre.7 and at com.unity.netcode.gameobjects@1.0.0-pre.9 I get other exception… does anyone else have this?
(0,0): error - System.NullReferenceException: Object reference not set to an instance of an object.| at Unity.Netcode.Editor.CodeGen.INetworkSerializableILPP.Process(ICompiledAssembly compiledAssembly) in /Users/remziemyumyunova/Multiplayer/Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.9/Editor/CodeGen/INetworkSerializableILPP.cs:line 116 at Unity.Netcode.Editor.CodeGen.INetworkSerializableILPP.Process(ICompiledAssembly compiledAssembly) in /Users/remziemyumyunova/Multiplayer/Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.9/Editor/CodeGen/INetworkSerializableILPP.cs:line 116
I am facing the same issue. I am trying to fix it on my own with a bypass to the reference or something like that. let’s see if that helps. If yes, I will post the workaround here.
I had the same issue. I made a “NetSingleton” for NetworkBehaviors. I removed any inheritance to it but the error was still there. It wasn’t until I deleted the script that the error went away.
using UnityEngine;
public abstract class NetSingleton<T> : NetworkBehaviour where T : NetSingleton<T>
{
public static T Instance { get; protected set; }
public static bool InstanceExists => Instance != null;
public static bool TryGetInstance(out T result)
{
result = Instance;
return result != null;
}
protected virtual void Awake()
{
if (Instance != null)
{
Debug.LogWarningFormat("Trying to create a second instance of {0}", typeof(T));
Destroy(gameObject);
}
else
{
Instance = (T)this;
DontDestroyOnLoad(gameObject);
}
}
new protected virtual void OnDestroy()
{
if (Instance == this)
{
Instance = null;
}
base.OnDestroy();
}
}
The latest Photon SDK must be Unity version 2021.3 or later to be able to do this. When you encounter this pitfall, earlier versions of Unity will report various errors
The issue exists only when I create a generic type singleton with a NetworkBehaviour. If you change the NetworkBehaviour to MonoBehaviour, the error won’t pop up.