Code Monkey home page Code Monkey logo

unity3d-autohook's Introduction

Auto Hook

GitHub package.json version GitHub issues GitHub pull requests GitHub license GitHub last commit

Auto Hook is a property drawer that automagically assigns a reference to your field.

Installation

  1. The package is available on the openupm registry. You can install it via openupm-cli.
openupm add net.tnrd.autohook
  1. You can also install via git url by adding these entries in your manifest.json
"net.tnrd.autohook": "https://github.com/Thundernerd/Unity3D-Autohook.git"

Usage

Using Auto Hook is easy. You just have to add the [AutoHook] attribute to any field that wants a component and it'll try to assign it.

public class Foo : MonoBehaviour
{
    [SerializeField, AutoHook]
    private Rigidbody rigidbody;

    [...]
}

There's some extra options that you can configure

Option Description
SearchArea Default
Matches GetComponent

Parent
Matches GetComponentInParent

Children
Matches GetComponentInChildren

DirectChildrenOnly
Iterates over the direct children of the current object only, ignoring itself and any children below that

AllChildrenOnly
Iterates over all children of the current object recursively, ignoring only itself
HideWhenFound Reduces the size of the property to 0 when a matching component has been found
ReadOnlyWhenFound Marks the property as read-only when a matching component has been found
StopSearchWhenFound Stops calling GetComponent (or other variants) when a matching component has been found. This is useful if you have many [AutoHook] usages in your file

Support

Auto Hook is originally made by LotteMakesStuff and can be found here.

You can support LotteMakesStuff through her ko-fi or by becoming her Patreon

ko-fi Become a Patron!

If you're feeling generous and you like my version then you can support me here

ko-fi

Contributing

Pull requests are welcomed. Please feel free to fix any issues you find, or add new features.

unity3d-autohook's People

Contributors

thundernerd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.