-
-
Save Versatilus/f8044141a68d022d9720ada8a4266c05 to your computer and use it in GitHub Desktop.
Replace lane props on networks in the asset editor.
This file contains hidden or 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
Action<string, string> ReplaceProp = (search, replace) => | |
{ | |
var replacementProp = PrefabCollection<PropInfo>.FindLoaded(replace); | |
for (uint i = 0; i < PrefabCollection<NetInfo>.LoadedCount(); i++) | |
{ | |
var prefab = PrefabCollection<NetInfo>.GetLoaded(i); | |
if (prefab == null) continue; | |
if(prefab.m_lanes != null) foreach (var Lane in prefab.m_lanes) | |
{ | |
if(Lane.m_laneProps != null) | |
{ | |
if(Lane.m_laneProps.m_props != null) foreach (var LaneProp in Lane.m_laneProps.m_props) | |
{ | |
if(LaneProp.m_prop != null) | |
{ | |
if(LaneProp.m_prop.name == search) | |
{ | |
LaneProp.m_prop = replacementProp; | |
LaneProp.m_finalProp = replacementProp; | |
Debug.Log("Replaced"); | |
} | |
} | |
} | |
} | |
} | |
} | |
}; | |
// Usage: ReplaceProp("replace this", "with that"); | |
ReplaceProp("darktun.darktun_Data", "1530239308.R69Railway Tunnel Darkener_Data"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment