FieldAccessException: Field `Unity.Netcode.NetworkBehaviour:NetworkVariableFields' is inaccessible from method `Unity.Netcode.NetworkBehaviourUpdater:NetworkBehaviourUpdate ()'
See original GitHub issueDescription
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
- OS: window 11
- Unity Version: 2021.3.19f1c1
- Netcode Version:1.5.1
- Netcode Commit: [e.g. https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/commit/ba418fa5b600ad9eb61fab0575f12fbecc2c6520]
Issue Analytics
- State:
- Created 3 months ago
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It worked!
On Wed, Jul 12, 2023 at 9:26 AM Noel Stephens @.***> wrote:
@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.