Search Feedback

4
votes

Implement SyncVar Struct synchronization when member variables are changed

Networking

-

-

[Struct]
Rect myRect;

myRect.x = 10; // Currently this line will not cause the variable to sync. Please support syncing data when individual variables or a structure change.

myRect = new Rect(10, myRect.y, myRect.width, myRect.height); // this line currently causes the structure to sync. But it is inefficient to be constantly calling new and synchronizing all member variables of the struct needlessly.

P.S. As a low cost improvement Unity can do immediately, you should also explicitly update SyncVar's documentation to show examples of proper and impropper usage of SyncVar for syncing structs.
https://docs.unity3d.com/ScriptReference/Networking.SyncVarAttribute.html

Comments (1)

  1. 9739c7c8bc82d880345d4c93abe588db?d=mm

    teamLab_davis

    Feb 13, 2018 02:15

    Code type-o above:
    [SyncVar]
    Rect myRect = new Rect();

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

(9911)

2D

(260)

Ads

(50)

AI & Navigation

(77)

Analytics

(115)

Animation

(366)

Asset Store

(271)

Assets

(510)

Audio

(169)

Cloud Build

(122)

Collaborate

(45)

Docs & Tutorials

(217)

Editor

(2293)

Everyplay

(13)

Game Performance Reporting

(16)

General

(890)

Graphics

(821)

GUI

(397)

Input

(157)

Licensing

(84)

Networking

(176)

Physics

(362)

Platforms

(427)

Profiling & Optimization

(76)

Runtime

(171)

Scripting

(1097)

Terrain

(164)

WebGL

(138)