Skip to main content

PlatformMeshController

A class in Root.Township, the global namespace.

Swaps a renderer's mesh and/or material on chosen platforms, at bake time and again on Awake in play.

Constructors​

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

Fields​

4 private and internal fields
MemberWhat it is
private PlatformMeshController.PlatformDetails[] replacementsReplacement mesh and material per platform, with flags to allow null.
private MeshFilter targetFilterMesh filter whose mesh is replaced.
private MeshRenderer targetRendererMesh renderer whose material is replaced.
private SkinnedMeshRenderer targetSkinnedMeshRendererSkinned mesh renderer whose mesh and material are replaced.

Methods​

MemberWhat it is
override void Bake(bool isSaving)Applies the first matching platform's replacement mesh and material to the target renderers.
static void CreatePlatformMeshController(Renderer renderer, Material newMaterial)Adds a controller to a renderer that swaps in the given material on Android.
1 private and internal method
MemberWhat it is
private void Awake()Applies the platform replacement when the game is running.