Skip to content

Instantly share code, notes, and snippets.

@ronyx69
Last active May 18, 2022 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ronyx69/adea99e2cd85d0231916679125349e56 to your computer and use it in GitHub Desktop.
Save ronyx69/adea99e2cd85d0231916679125349e56 to your computer and use it in GitHub Desktop.
Replace target networks with replacement networks. Could break everything idk.
// replace all target nets with replacement net
var target = PrefabCollection<NetInfo>.FindLoaded("Pedestrian Connection Surface");
var replacement = PrefabCollection<NetInfo>.FindLoaded("Pedestrian Connection");
var b = NetManager.instance.m_segments.m_buffer;
for(var i=0;i<b.Length;i++) if(b[i].m_flags!=0) if(b[i].Info==target) b[i].Info=replacement;
var b2 = NetManager.instance.m_nodes.m_buffer;
for(var i=0;i<b2.Length;i++) if(b2[i].m_flags!=0) if(b2[i].Info==target) b2[i].Info=replacement;
for(var i=0;i<b.Length;i++) if(b[i].m_flags!=0) NetManager.instance.UpdateSegment((ushort)i);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment