Instantly share code, notes, and snippets.

Embed
What would you like to do?
Change the shader of a building sub mesh to prop default in asset editor.
var subMesh = 0; // sub mesh id, order as in ui, starting from 0
var shader = Shader.Find("Custom/Props/Prop/Default"); // the shader to use
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as BuildingInfo;
asset.m_subMeshes[subMesh].m_subInfo.m_material.shader = shader;
asset.m_subMeshes[subMesh].m_subInfo.m_lodMaterial.shader = shader;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment