https://github.com/simeonradivoev/namedreferences
A small utility for the unity editor that shows references to and from the selected game object in the hierarchy window.
https://github.com/simeonradivoev/namedreferences
Last synced: 3 months ago
JSON representation
A small utility for the unity editor that shows references to and from the selected game object in the hierarchy window.
- Host: GitHub
- URL: https://github.com/simeonradivoev/namedreferences
- Owner: simeonradivoev
- Created: 2024-02-01T18:25:27.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-02-11T12:53:23.000Z (over 1 year ago)
- Last Synced: 2025-01-08T11:40:52.335Z (4 months ago)
- Language: C#
- Size: 23.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A small utility for the unity editor that shows references to and from the selected game object in the hierarchy window.
Was created mainly to address, me always losing what references what after I come back to a project after a while.## How to Use
You can skip this and only use the visualizer of references that alone comes in handy.
To use it add a `NamedReferenceAttribute` to a serialized field of a game object or component. During runtime references will be assigned automatically. Here are some examples:
````csharp
[NamedReference("#Test")]
public GameObject Reference;[NamedReference("#Test",true)]
public GameObject DirectReference;
````To use at runtime there are helper extension methods for transforms like this:
````csharp
transform.FindAnyChild("#TestChild");
transform.FindAnyChild("#TestChildImage");
transform.FindAnyChildDirect("#TestDirectChild");
transform.FindAnyChildDirect("#TestDirectSlider");
````There are 2 types of children:
### Direct (Only children that are direct parents of the root will be selected)
* Root
* #Child_1
* #TestChild
* #TestChildIn the example above searching for the `#TestChild` from root, only the second `#TestChild` will be valid as it is not a part of another parent starting with the `#` character. This character is used as an indicator.
### Any
This will ignore any parent that start with the `#` character## Screenshots
Green is references to the selected object and yellow is references from the selected object.
## Tests
Unfortunately I couldn't do tests as the object callbacks aren't called when tests are run. If anybody has ideas how to do proper tests in this case please let me know.