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

(9607)

2D

(250)

Ads

(47)

AI & Navigation

(75)

Analytics

(109)

Animation

(346)

Asset Store

(255)

Assets

(502)

Audio

(161)

Cloud Build

(114)

Collaborate

(40)

Docs & Tutorials

(212)

Editor

(2211)

Everyplay

(13)

Game Performance Reporting

(16)

General

(852)

Graphics

(802)

GUI

(388)

Input

(154)

Licensing

(80)

Networking

(170)

Physics

(358)

Platforms

(421)

Profiling & Optimization

(73)

Runtime

(168)

Scripting

(1067)

Terrain

(160)

WebGL

(136)