Help Changing extruded renderer's material runtime - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html) +--- Thread: Help Changing extruded renderer's material runtime (/thread-4426.html) |
Changing extruded renderer's material runtime - aderae - 10-12-2024 Hello, I have a logic where I need to change the ropes material during runtime. I tried setting obiRopeExtrudedRenderer.material = new Material(copyFrom); it looks like the material is changed in the component itself but it doesn't effect the renderer. I assume this is cached on start. Is there a way to do this? Thanks RE: Changing extruded renderer's material runtime - josemendez - 10-12-2024 Hi, Yes, you just need to flag the renderer dirty after changing the material: Code: ((ObiActorRenderer<ObiRopeExtrudedRenderer)renderer).SetRendererDirty(Oni.RenderingSystemType.AllSmoothedRopes); This will refresh the material and trigger a re-batching of all ropes to minimize the amount of batches next time the rope is rendered. Note this is a somewhat expensive operation. kind regards, RE: Changing extruded renderer's material runtime - aderae - 10-12-2024 Thank you! I am amazed how robust you guys made this API as always |