A class in Root.Township, Alta.Scrapper.
Network behaviour that sets a part's mesh, material and local transform from a hashed MeshPlacementData asset, saved with the entity and synced to players when they join.
Constructors
| Member | What it is |
|---|
MeshPlacement() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private MeshPlacementData data | The placement asset in use, set on load. |
private MeshFilter meshFilter | Mesh filter that gets the mesh. |
private MeshRenderer meshRenderer | Renderer that gets the material. |
private MethodSync sync | The sync for the asset. |
private Transform transform | Transform that gets the local scale, rotation and position. |
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() | Applies the asset's scale, rotation, position, mesh and material. |
private void OnValidate() | Does nothing. |
private void Sync(IPlayer player, Stream stream) | Message handler: serializes the asset and applies it on remote clients. |