Skip to main content

MeshPlacement

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​

MemberWhat it is
MeshPlacement()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

5 private and internal fields
MemberWhat it is
private MeshPlacementData dataThe placement asset in use, set on load.
private MeshFilter meshFilterMesh filter that gets the mesh.
private MeshRenderer meshRendererRenderer that gets the material.
private MethodSync syncThe sync for the asset.
private Transform transformTransform that gets the local scale, rotation and position.

Methods​

MemberWhat 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
MemberWhat 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.