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.

FieldAccessException: Field `Unity.Netcode.NetworkBehaviour:NetworkVariableFields' is inaccessible from method `Unity.Netcode.NetworkBehaviourUpdater:NetworkBehaviourUpdate ()'

See original GitHub issue

Description

i upgrade netcode 1.2 to 1.5.1, and i import the whole package into my project(because i need use addressable for networkprefab, so i
modify some code on generating networkobject hash id method), the server works fine on the editor mode. but i got an error when working on dedicated server(win64) build, this error message shows every frame.

Screenshots

Failed to load type initialization for assembly Unity.Multiplayer.Tools.NetStatsReporting
Failed to load type initialization for assembly Unity.Multiplayer.Tools.MetricTypes
FieldAccessException: Field `Unity.Netcode.NetworkBehaviour:NetworkVariableFields' is inaccessible from method `Unity.Netcode.NetworkBehaviourUpdater:NetworkBehaviourUpdate ()'
  at Unity.Netcode.NetworkBehaviourUpdater.NetworkBehaviourUpdater_Tick () [0x00000] in <9d8627c8ce4c4fd788ca2dee561029ab>:0
  at (wrapper delegate-invoke) <Module>.invoke_void()
  at Unity.Netcode.NetworkTickSystem.UpdateTick (System.Double localTimeSec, System.Double serverTimeSec) [0x000ad] in <9d8627c8ce4c4fd788ca2dee561029ab>:0
  at Unity.Netcode.NetworkTimeSystem.UpdateTime () [0x00067] in <9d8627c8ce4c4fd788ca2dee561029ab>:0
  at Unity.Netcode.NetworkManager.NetworkUpdate (Unity.Netcode.NetworkUpdateStage updateStage) [0x00040] in <9d8627c8ce4c4fd788ca2dee561029ab>:0
  at Unity.Netcode.NetworkUpdateLoop.RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage updateStage) [0x00021] in <9d8627c8ce4c4fd788ca2dee561029ab>:0
  at Unity.Netcode.NetworkUpdateLoop+NetworkPreUpdate+<>c.<CreateLoopSystem>b__0_0 () [0x00000] in <9d8627c8ce4c4fd788ca2dee561029ab>:0

Unloading 4 Unused Serialized files (Serialized files now loaded: 11)
FieldAccessException: Field `Unity.Netcode.NetworkBehaviour:NetworkVariableFields' is inaccessible from method `Unity.Netcode.NetworkBehaviourUpdater:NetworkBehaviourUpdate ()'
  at Unity.Netcode.NetworkBehaviourUpdater.NetworkBehaviourUpdater_Tick () [0x00000] in <9d8627c8ce4c4fd788ca2dee561029ab>:0
  at (wrapper delegate-invoke) <Module>.invoke_void()
  at Unity.Netcode.NetworkTickSystem.UpdateTick (System.Double localTimeSec, System.Double serverTimeSec) [0x000ad] in <9d8627c8ce4c4fd788ca2dee561029ab>:0
  at Unity.Netcode.NetworkTimeSystem.UpdateTime () [0x00067] in <9d8627c8ce4c4fd788ca2dee561029ab>:0
  at Unity.Netcode.NetworkManager.NetworkUpdate (Unity.Netcode.NetworkUpdateStage updateStage) [0x00040] in <9d8627c8ce4c4fd788ca2dee561029ab>:0
  at Unity.Netcode.NetworkUpdateLoop.RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage updateStage) [0x00021] in <9d8627c8ce4c4fd788ca2dee561029ab>:0
  at Unity.Netcode.NetworkUpdateLoop+NetworkPreUpdate+<>c.<CreateLoopSystem>b__0_0 () [0x00000] in <9d8627c8ce4c4fd788ca2dee561029ab>:0

Environment

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
gradientogamescommented, Jul 11, 2023

It worked!

On Wed, Jul 12, 2023 at 9:26 AM Noel Stephens @.***> wrote:

@gradientogames https://github.com/gradientogames Just wondering if that branch resolved your issue? If so, PR-2614 https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/pull/2614 is being reviewed and those fixes will be in the next update.

If not, then let me know so I can investigate the issue further.

— Reply to this email directly, view it on GitHub https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/issues/2597#issuecomment-1631631250, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP6UKCTYKFFKQHMNQPDNZQDXPXOJNANCNFSM6AAAAAAZS775NU . You are receiving this because you were mentioned.Message ID: <Unity-Technologies/com.unity.netcode.gameobjects/issues/2597/1631631250@ github.com>

1reaction
NoelStephensUnitycommented, Jun 30, 2023

@gradientogames Yeah, there seems to be some issues with the ILPP side when stripping is enabled. We do have a fix for that issue, but for the time being if you prefer to use only the current released package then you will need to have stripping disabled (until the update/patch is available).

Otherwise, if you are more adventurous then you could replace your com.unity.netcode.gameobjects entry in your manifest file with this: "com.unity.netcode.gameobjects": "https://github.com/Unity-Technologies/com.unity.netcode.gameobjects.git?path=com.unity.netcode.gameobjects#fix/ilpp-stripping-and-coreclr-compatibility",

And see if those fixes resolve the issue you are running into when making a dedicated server build.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[NetCode] Generated NetCode Method is Inaccessible ...
As soon as I'm using a SendRpcCommandRequestComponent, I get the following error: Code (Text):. MethodAccessException: Method `Networking.
Read more >
COMPLETE Unity Multiplayer Tutorial (Netcode for ... - YouTube
00:00 Getting Started with Unity Multiplayer ( Netcode for Game Objects) 02:19 Installing Netcode for Game Objects 03:18 NetworkManager 04:07 ...
Read more >
Unity Netcode for Entities
Netcode for Entities requires you to have Unity version 2022.2.0f1 or higher. This package uses Unity's Entity Component System (ECS) as a foundation....
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