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

(10244)

2D

(266)

Ads

(51)

AI & Navigation

(78)

Analytics

(121)

Animation

(379)

Asset Store

(295)

Asset Store Publisher

(7)

Assets

(524)

Audio

(173)

Cloud Build

(135)

Collaborate

(48)

Docs & Tutorials

(233)

Editor

(2374)

Everyplay

(13)

Game Performance Reporting

(16)

General

(919)

Graphics

(847)

GUI

(413)

Input

(160)

Licensing

(86)

Networking

(181)

Physics

(372)

Platforms

(434)

Profiling & Optimization

(78)

Runtime

(176)

Scripting

(1131)

Terrain

(167)

WebGL

(140)