All Projects → merpheus-dev → GetComponentAttribute

merpheus-dev / GetComponentAttribute

Licence: other
A simple DI plugin for getting MonoBehaviour components just with an attribute over fields.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to GetComponentAttribute

python-pyfields
Define fields in python classes. Easily.
Stars: ✭ 39 (+178.57%)
Mutual labels:  attribute
lovelace-attribute-entity-row
Show attribute(s) on entity rows in Home Assistant's Lovelace UI
Stars: ✭ 21 (+50%)
Mutual labels:  attribute
property-information
Info on the properties and attributes of the web platform
Stars: ✭ 27 (+92.86%)
Mutual labels:  attribute
xml.nim
Simple XML parser in pure Nim
Stars: ✭ 16 (+14.29%)
Mutual labels:  attribute
python-autoclass
A python 3 library providing functions and decorators to automatically generate class code, such as constructor body or properties getters/setters along with optional support of validation contracts on the generated setters. Its objective is to reduce the amount of copy/paste code in your classes - and hence to help reducing human mistakes :).
Stars: ✭ 30 (+114.29%)
Mutual labels:  attribute
akeneo-table-attribute-bundle
The Flagbit Table Attribute Bundle for Akeneo PIM gives you the possibility to enrich your product with multi-dimensional data presentation in the form of tables, allowing you maximum flexibility within the PIM.
Stars: ✭ 20 (+42.86%)
Mutual labels:  attribute
FaceAttributeManipulation
An implementation of Learning Residual Images for Face Attribute Manipulation
Stars: ✭ 52 (+271.43%)
Mutual labels:  attribute
lovelace-battery-entity-row
Show battery states or attributes with dynamic icon on entity rows in Home Assistant's Lovelace UI
Stars: ✭ 49 (+250%)
Mutual labels:  attribute

Get Component Attribute

A little attribute that makes Awake/Start GetComponent calls redundant.

Generally in unity, we need to fill fields like this as follows:

private Rigidbody rigidbody;
void Start(){
    rigidbody = GetComponent<Rigidbody>();
}

But especially while working with teams, if you DI through Scene objects from inspector, Scene merge conflicts become inevitable. But we shouldn't dirty our code base with those get component methods in various fields. It will reduce readability. This plugin, removes this requirement and takes care of it with an attribute in background before scene begins.

Example Usage

[GetComponent] //Get from same gameobject
private Rigidbody rigidbody;

[GetComponent(GetComponentFrom.SceneObject)] //Scan the scene and get from first object.
private Rigidbody rigidbody;

[GetComponent(GetComponentFrom.TargetGameObject,"MyAwesomeTargetObjectName")] //Get from a target object at scene
private Rigidbody rigidbody;

Installation

Just clone the repo and copy the folder into your project.

Note

[!]GetComponentFrom.TargetGameObject currently runs between awake and start methods.

TO-DO

  • Editor time component fetching
  • On-demand(non awake based) runtime component fetching
  • Fetch signals(Event driven fetch on runtime)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].