add the delay back out of fear

This commit is contained in:
JohnCorby 2022-07-21 16:51:57 -07:00
parent 93e35ddc97
commit 882b5c4571

View File

@ -275,22 +275,25 @@ namespace NewHorizons.Handlers
if (body.Config.removeChildren != null) if (body.Config.removeChildren != null)
{ {
var goPath = go.transform.GetPath(); Delay.FireInNUpdates(() =>
var transforms = go.GetComponentsInChildren<Transform>(true);
foreach (var childPath in body.Config.removeChildren)
{ {
// Multiple children can have the same path so we delete all that match var goPath = go.transform.GetPath();
var path = $"{goPath}/{childPath}"; var transforms = go.GetComponentsInChildren<Transform>(true);
foreach (var childPath in body.Config.removeChildren)
var flag = true;
foreach (var childObj in transforms.Where(x => x.GetPath() == path))
{ {
flag = false; // Multiple children can have the same path so we delete all that match
childObj.gameObject.SetActive(false); var path = $"{goPath}/{childPath}";
}
if (flag) Logger.LogWarning($"Couldn't find \"{childPath}\"."); var flag = true;
} foreach (var childObj in transforms.Where(x => x.GetPath() == path))
{
flag = false;
childObj.gameObject.SetActive(false);
}
if (flag) Logger.LogWarning($"Couldn't find \"{childPath}\".");
}
}, 2);
} }
// Do stuff that's shared between generating new planets and updating old ones // Do stuff that's shared between generating new planets and updating old ones