File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Unity3D-ComponentAttribute
2
+ An attribute that let's you auto-load components
3
+
4
+ * Works on fields and properties
5
+ * Load components on awake (ExtendedBehaviour only)
6
+ * Disable component on error (optional)
7
+
8
+
9
+ The way of ExtendedBehaviour
10
+ ---------------------------
11
+ You can derive your custom behaviour from the ExtendedBehaviour class.
12
+
13
+ The only thing left to do is add the component attribute to fields or properties and you are ready to go.
14
+
15
+ ![ ExtendedBehaviour] ( http://puu.sh/lmyDs/ebeb03e5ad.png )
16
+
17
+ The downsides of using this way are (in my opinion)
18
+
19
+ 1 . You have to make your custom behaviour inherit from ExtendedBehaviour.
20
+ 2 . If you want to use Awake() you have to override it instead of the standard definition.
21
+
22
+ The way of this.LoadComponents()
23
+ --------------------------------
24
+ Call * this.LoadComponents()* In the Start() or Awake() (or wherever you want to put it, really).
25
+
26
+ The only thing left to do is add the component attribute to fields or properties and you are ready to go.
27
+
28
+ ![ Extension] ( http://puu.sh/lmyB4/2b3e79b708.png )
29
+
30
+ The downsides of using this way are (in my opinion)
31
+
32
+ 1 . You have to call this.LoadComponents, which you might forget.
33
+ 2 . I forget things fast, which makes point one worse.
You can’t perform that action at this time.
0 commit comments