Add as custom git package with package manager:
- Open package manager
- Click on the plus (➕) button
- Choose "Add package from git URL"
- Past the url:
https://github.com/AndersonMarquess/AM_DI.git?path=/Packages/DependencyInitializer
or
Set direct reference in manifest.json:
"com.andersonmarques.dependencyinitializer": "https://github.com/AndersonMarquess/AM_DI.git?path=/Packages/DependencyInitializer"
1 - Just add the desired attribute on the field that will be filled.
2 - In the transform of the gameobject, just click on "Find"
3 - Done!
[SerializeField, FindInScene]
private Light _sceneMainLight = null;
[SerializeField, FindInScene(ActiveOnly = true)]
private SphereCollider _activeSphereInScene = null;
[SerializeField, FindInParent]
private MockComponent _parentComponent = null;
[SerializeField, FindInParent(IgnoreSelf = false)]
private Transform _firstAvailableTransform = null;
[SerializeField, FindInComponent]
private NavMeshAgent _myNavMeshAgent = null;
[SerializeField, FindInChild]
private Renderer _childRenderer = null;
[SerializeField, FindInChild(Path = "Plane/InnerChild")]
private Renderer _specifChildRenderer = null;
[SerializeField, Initializable]
private MyDefaultCsharpClass _compositionClass = null;
[Serializable]
class MyDefaultCsharpClass
{
[SerializeField, FindInChild]
private Renderer _childRenderer = null;
}
- Find In Scene
- Active
- Find In Parent
- Ignore Self
- Find In Component
- Find In Child
- Active
- With Path
- Default class initialization
Drag and drop can be time consuming when done over and over again, having a button to fill dependencies saved me a lot of time.
- Yes, can be used commercially.
- No, you don't have to credit me, but that would be nice.
- MIT License.