Skip to content

Instantly share code, notes, and snippets.

Last active April 4, 2018 14:59
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Change various network variables in asset editor.
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