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

(10535)

2D

(274)

Ads

(52)

AI & Navigation

(78)

Analytics

(125)

Animation

(390)

Asset Store

(333)

Asset Store Publisher

(10)

Assets

(536)

Audio

(176)

Cloud Build

(139)

Collaborate

(57)

Docs & Tutorials

(238)

Editor

(2459)

Everyplay

(15)

Game Performance Reporting

(15)

General

(953)

Graphics

(861)

GUI

(423)

Input

(166)

Licensing

(88)

Networking

(185)

Physics

(380)

Platforms

(438)

Profiling & Optimization

(81)

Runtime

(180)

Scripting

(1148)

Terrain

(168)

WebGL

(141)