/// <summary> /// Draws an existing ConduitFlowMesh without updating it. /// </summary> /// <param name="flowMesh">The mesh to draw.</param> /// <param name="z">The z coordinate to render the mesh.</param> /// <param name="layer">The layer for rendering.</param> private static void DrawMesh(ConduitFlowMesh flowMesh, float z, int layer) { if (flowMesh != null) { Graphics.DrawMesh(flowMesh.mesh, new Vector3(0.5f, 0.5f, z - 0.1f), Quaternion. identity, flowMesh.material, layer); } }
/// <summary> /// Applied after the constructor runs. /// </summary> internal static void Postfix(ConduitFlowMesh __instance) { var mesh = __instance.mesh; if (mesh != null) { // Destroy the existing renderer if it exists if (visualizers.TryGetValue(mesh, out ConduitMeshVisualizer visualizer)) { visualizer.DestroyRenderer(); } visualizers[mesh] = ConduitMeshVisualizer.Create(mesh, __instance. material); } }