Last active
April 4, 2018 14:59
-
-
Save ronyx69/1cad5d2bc559023183bbaf29d5c8abb2 to your computer and use it in GitHub Desktop.
Change various network variables 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 asset = ToolsModifierControl.toolController.m_editPrefabInfo as NetInfo; | |
// change half width | |
asset.m_halfWidth = 22.0f; | |
// enable create pavement | |
asset.m_createPavement = true; | |
// change the color of basic segment 0 | |
var color = new Color32(255, 0, 0, 255); | |
asset.m_segments[0].m_material.SetColor("_Color", color); | |
// change the color of elevated segment 0 | |
var color2 = new Color32(0, 255, 0, 255); | |
(asset.m_netAI.GetType().GetField("m_elevatedInfo").GetValue(asset.m_netAI) as NetInfo).m_segments[0].m_material.SetColor("_Color", color2); | |
// refresh UI and built network | |
typeof(RoadEditorMainPanel).GetMethod("Clear", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(UnityEngine.Object.FindObjectOfType<RoadEditorMainPanel>(), null); | |
typeof(RoadEditorMainPanel).GetMethod("Initialize", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(UnityEngine.Object.FindObjectOfType<RoadEditorMainPanel>(), null); | |
typeof(RoadEditorPanel).GetMethod("OnObjectModified", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(UnityEngine.Object.FindObjectOfType<RoadEditorPanel>(), null); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment