Search Feedback

0
votes

UNET OnServerAddPlayer needs to be able to initialize SyncVars

Networking

-

-

I'm seeing an issue with the program flow of UNET, specifically around OnServerAddPlayer with SyncVars

SyncVars have their values synced when NetworkBehaviour.OnStartClient is called, which is ideal for initialization, whereas any future changes to the SyncVar activate the hook.

OnServerAddPlayer is, as far as I can tell, the earliest possible way the server can receive parameters from the client, and use it to set the values of SyncVars.

The issue is that any changes to SyncVars from OnServerAddPlayer are carried out as SyncVar updates, as opposed to SyncVar initialization.

What this means is that the Server doesn't receive the user's parameters until after the user's NetworkBehaviours have already initialized their SyncVars.

It seems that OnServerAddPlayer should be a crucial part of the initialization, at least on the server side

Your opinion counts

Help us make things better. Share your great idea for improving Unity or vote for other people’s.

Log in to post a new idea

Categories

All

(10781)

2D

(281)

Ads

(55)

AI & Navigation

(82)

Analytics

(133)

Animation

(396)

Asset Store

(355)

Asset Store Publisher

(17)

Assets

(543)

Audio

(184)

Cloud Build

(145)

Collaborate

(64)

Docs & Tutorials

(240)

Editor

(2507)

Everyplay

(19)

Game Performance Reporting

(22)

General

(980)

Graphics

(870)

GUI

(432)

Input

(173)

Licensing

(92)

Networking

(189)

Physics

(384)

Platforms

(442)

Profiling & Optimization

(85)

Runtime

(182)

Scripting

(1168)

Terrain

(172)

WebGL

(143)