Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit95280a384c

README.md

appearance.swapShader

Swap the shader on a material while preserving its texture links and property values as far as possible. The change is written to the material asset itself and marks every instance dirty, so it persists and propagates to all entities using that material. Because each shader has its own property and texture vocabulary, values carry across by canonical role — the base-color texture, for instance, maps regardless of what each shader names it — and anything outside the new shader's vocabulary is dropped; the result lists what was carried and what was dropped.

Target entity hierarchies (one root, a list, or the whole scene): every component field that holds a material reference is read, and every distinct material those fields carry is swapped. To change the shader of one material you already hold, call matRef:setShader(shader) on it.