Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Replace lane props on networks in the asset editor.
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
You can’t perform that action at this time.