mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
make findchild take path and also be an extension method
This commit is contained in:
parent
d5b9376fc3
commit
bb3b111358
@ -265,7 +265,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
// setup for visually supporting async texture loading
|
||||
mindSlideProjector.enabled = false;
|
||||
var visionBeamEffect = SearchUtilities.FindChild(standingTorch, "VisionBeam");
|
||||
var visionBeamEffect = standingTorch.FindChild("VisionBeam");
|
||||
visionBeamEffect.SetActive(false);
|
||||
|
||||
//
|
||||
|
||||
@ -118,15 +118,7 @@ namespace NewHorizons.Utility
|
||||
}
|
||||
*/
|
||||
|
||||
public static GameObject FindChild(GameObject g, string childName)
|
||||
{
|
||||
foreach(Transform child in g.transform)
|
||||
{
|
||||
if (child.gameObject.name == childName) return child.gameObject;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public static GameObject FindChild(this GameObject g, string path) => g?.transform?.Find(path)?.gameObject;
|
||||
|
||||
public static GameObject Find(string path, bool warn = true)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user