A class in Root.Township, Alta.Scrapper.
Network behaviour that turns a set of mesh renderers on or off from a hashed VisibilityData asset, saved with the entity and synced to players when they join.
Constructors
| Member | What it is |
|---|
Visibility() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
3 private and internal fields
| Member | What it is |
|---|
private VisibilityData data | The visibility asset in use. If a save has none, load picks a random one. |
private MeshRenderer[] meshRenderers | Renderers it shows or hides. |
private MethodSync sync | The sync for the asset. |
Methods
| Member | What it is |
|---|
override void Initialize() | Sets up the sync on SyncScrapper. |
override void OnConnected(Player player) | Sends the current asset to the joining player. |
void Serialize(Stream stream) | Writes or reads the asset by hash; remote clients take the read value. |
3 private and internal methods
| Member | What it is |
|---|
private void ApplyData() | Sets every renderer's enabled to the asset's value. |
private void OnValidate() | Does nothing. |
private void Sync(IPlayer player, Stream stream) | Message handler: serializes the asset and applies it on remote clients. |