Last active
October 15, 2016 02:20
-
-
Save boformer/57d98a7228f1d239e402 to your computer and use it in GitHub Desktop.
Switch between "Fence" and "Default" shader in asset editor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var defaultShader = Shader.Find("Custom/Buildings/Building/Default"); | |
var fenceShader = Shader.Find("Custom/Buildings/Building/Fence"); | |
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as BuildingInfo; | |
if(asset == null) { Debug.Log("Error: Not a building!"); return; } | |
if(asset.m_material.shader == defaultShader) | |
{ | |
asset.m_requireHeightMap = true; | |
asset.m_material.shader = fenceShader; | |
asset.m_lodMaterial.shader = fenceShader; | |
} | |
else | |
{ | |
asset.m_requireHeightMap = false; | |
asset.m_material.shader = defaultShader; | |
asset.m_lodMaterial.shader = defaultShader; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment