Skip to content

Commit

Permalink
com.utilities.extensions 1.1.17 (#25)
Browse files Browse the repository at this point in the history
- added Transform.FindChildRecursive
  • Loading branch information
StephenHodgson authored Dec 25, 2024
1 parent 7343679 commit ea11fc6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/unity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ ( github.event_name == 'pull_request' || github.event.action == 'synchronize' ) }}
cancel-in-progress: ${{(github.event_name == 'pull_request' || github.event.action == 'synchronize')}}
permissions:
checks: write
pull-requests: write
Expand All @@ -23,14 +23,14 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13]
os: [ubuntu-latest, windows-latest, macos-latest]
unity-versions: [2021.x, 2022.x, 6000.x]
include:
- os: ubuntu-latest
build-target: StandaloneLinux64
- os: windows-latest
build-target: StandaloneWindows64
- os: macos-13
- os: macos-latest
build-target: StandaloneOSX
steps:
- uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,5 +464,24 @@ public static void ScaleAround(this Transform target, Vector3 pivot, Vector3 new
target.localScale = newScale;
target.localPosition = finalPosition;
}

/// <summary>
/// Find a child transform with the specified name.
/// </summary>
/// <param name="parent">The parent to start search from.</param>
/// <param name="name">The name of the transform to find.</param>
/// <returns><see cref="Transform"/> that matches <see cref="name"/> or null.</returns>
public static Transform FindChildRecursive(this Transform parent, string name)
{
for (int i = 0; i < parent.childCount; i++)
{
var child = parent.GetChild(i);
if (child.name.Contains(name)) { return child; }
var result = child.FindChildRecursive(name);
if (result != null) { return result; }
}

return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Utilities.Extensions",
"description": "Common extensions for Unity types (UPM)",
"keywords": [],
"version": "1.1.16",
"version": "1.1.17",
"unity": "2021.3",
"documentationUrl": "https://github.com/RageAgainstThePixel/com.utilities.extensions#documentation",
"changelogUrl": "https://github.com/RageAgainstThePixel/com.utilities.extensions/releases",
Expand Down

0 comments on commit ea11fc6

Please sign in to comment.