Inheritaded network variable wont update on clients.
See original GitHub issueI have this class
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Netcode;
public class RoomSync : NetworkBehaviour
{
public NetworkVariable<int> netCurrentRoom = new NetworkVariable<int>(0, NetworkVariableReadPermission.Everyone, NetworkVariableWritePermission.Server);
public int currentRoom = 999;
public void Start()
{
if (NetworkManager.Singleton.IsServer)
{
netCurrentRoom.Value = currentRoom;
}
}
}
If I make a GameObject with a class that inherits RoomSync the NetworkVariable will change on servers but wont be updated on clients giving the error
NetworkVariable is written to, but doesn’t know its NetworkBehaviour yet. Are you modifying a NetworkVariable before the NetworkObject is spawned?
Issue Analytics
- State:
- Created 5 months ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
NetworkVariable update before ClientRpc
Network variables should match on all clients, or at least will eventually once the updates has been received. It's worth keeping in mind ......
Read more >NetworkVariable | Unity Multiplayer Networking
At a high level, a NetworkVariable is a way to synchronize a property ("variable") between a server and client(s) without having to use ......
Read more >How do I update the client with server side variables during ...
I am using VS2012 and ASP.NET 4.5. EDIT: To be more specific, the problem occurs while the server is busy with the loop....
Read more >Is it possible to pass variable from gateway scope to client ...
I have a GW timer script that is calling a script library function which updates a module variable defined within the library itself....
Read more >CMD doesn't update environment variables even when ...
I've been setup my variables for my development environment using the Windows cmd, but it works well only the first time I set...
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
I found on version 1.3.1. Will try later on 1.4.0 and report results.
Hello @brunosly how did it go? Are you still having this issue? Thanks!