GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Thundernerd/Unity3D-ComponentAttribute: An attribute that let's you auto-load components

BranchesTags
Open more actions menu

Latest commit

 

History

34 Commits
34 Commits

Folders and files

NameName
Last commit message
Last commit date
ComponentAttribute
ComponentAttribute
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

Unity3D-ComponentAttribute

An attribute that let's you auto-load components

  • Works on fields and properties
  • Load components on awake, start, or enable, or whenever else you feel like it
  • Get component from other GameObjects (optional)
  • Add component if missing (optional)
  • Disable component on error (optional)

Credits go to @ChevyRay for inspiring me to make this by this tweet

The way of this.LoadComponents()

The only thing you have to do is add the component attribute to fields and/or properties that you want and call this.LoadComponents(); in the awake, start, on enable, or any other place for that matter and you are good to go.

Pros:

  • You don't have to do all those GetComponent calls to get the components you need
  • The more components you want, the less you have to do

Cons:

  • You have to write [Component] on top the of the Components you want this to work on
  • You also have to call this.LoadComponents();

Fields Example

Imgur

Properties Example

Imgur

About

An attribute that let's you auto-load components

Resources

Readme
MIT license
Activity

Stars

58 stars

Watchers

9 watching

Forks

10 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.