mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
use FindAll
This commit is contained in:
parent
c5ae20d22b
commit
3a490cee89
@ -220,15 +220,10 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
if (detail.removeChildren != null)
|
if (detail.removeChildren != null)
|
||||||
{
|
{
|
||||||
var detailPath = prop.transform.GetPath();
|
|
||||||
var transforms = prop.GetComponentsInChildren<Transform>(true);
|
|
||||||
foreach (var childPath in detail.removeChildren)
|
foreach (var childPath in detail.removeChildren)
|
||||||
{
|
{
|
||||||
// Multiple children can have the same path so we delete all that match
|
|
||||||
var path = $"{detailPath}/{childPath}";
|
|
||||||
|
|
||||||
var flag = true;
|
var flag = true;
|
||||||
foreach (var childObj in transforms.Where(x => x.GetPath() == path))
|
foreach (var childObj in prop.transform.FindAll(childPath))
|
||||||
{
|
{
|
||||||
flag = false;
|
flag = false;
|
||||||
childObj.gameObject.SetActive(false);
|
childObj.gameObject.SetActive(false);
|
||||||
|
|||||||
@ -1000,15 +1000,10 @@ namespace NewHorizons.Handlers
|
|||||||
|
|
||||||
private static void RemoveChildren(GameObject go, NewHorizonsBody body)
|
private static void RemoveChildren(GameObject go, NewHorizonsBody body)
|
||||||
{
|
{
|
||||||
var goPath = go.transform.GetPath();
|
|
||||||
var transforms = go.GetComponentsInChildren<Transform>(true);
|
|
||||||
foreach (var childPath in body.Config.removeChildren)
|
foreach (var childPath in body.Config.removeChildren)
|
||||||
{
|
{
|
||||||
// Multiple children can have the same path so we delete all that match
|
|
||||||
var path = $"{goPath}/{childPath}";
|
|
||||||
|
|
||||||
var flag = true;
|
var flag = true;
|
||||||
foreach (var childObj in transforms.Where(x => x.GetPath() == path))
|
foreach (var childObj in go.transform.FindAll(childPath))
|
||||||
{
|
{
|
||||||
flag = false;
|
flag = false;
|
||||||
// idk why we wait here but we do
|
// idk why we wait here but we do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user