Skip to content

Commit 2346085

Browse files
committed
Update: README
1 parent aa19299 commit 2346085

2 files changed

Lines changed: 40 additions & 2 deletions

File tree

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,26 @@ void Awake()
9797
}
9898
```
9999

100+
It is also possible to specify the property name of the generated cache. If not specified, the class name of the target component converted to lower camel case will be used.
101+
102+
```cs
103+
using UnityEngine;
104+
using ComponentCacheGenerator;
105+
106+
[GenerateComponentCache(typeof(FooComponent), "foo")]
107+
[GenerateComponentCache(typeof(BarComponent), "bar")]
108+
[GenerateComponentCache(typeof(BazComponent), "baz")]
109+
public partial class SomeBehaviour : MonoBehaviour
110+
{
111+
void Update()
112+
{
113+
foo.Foo();
114+
bar.Bar();
115+
bazCBaz();
116+
}
117+
}
118+
```
119+
100120
## Generation Options
101121

102122
You can specify generation code settings by specifying values for properties in the `[GenerateComponentCache]` attribute.
@@ -105,7 +125,6 @@ You can specify generation code settings by specifying values for properties in
105125
| - | - |
106126
| SearchScope | Specifies the scope to search for components. If multiple are specified, the search will be performed in the order of Self > Children > Parent. (Default is Self) |
107127
| IsRequired | If IsRequired is true, an exception will be thrown if the component is not found when `CacheComponents()` is called. If the search scope is Self, `[RequireComponent]` attribute will be automatically generated. (Default is true) |
108-
| PropertyName | Specifies the name of the generated property. If not specified, the lower camel case version of the target component's class name will be used. |
109128

110129
## License
111130

README_JA.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,26 @@ void Awake()
9797
}
9898
```
9999

100+
また、生成されるキャッシュのプロパティ名を指定することも可能です。指定がない場合には対象のコンポーネントのクラス名をlower camel caseに変換した名前が使用されます。
101+
102+
```cs
103+
using UnityEngine;
104+
using ComponentCacheGenerator;
105+
106+
[GenerateComponentCache(typeof(FooComponent), "foo")]
107+
[GenerateComponentCache(typeof(BarComponent), "bar")]
108+
[GenerateComponentCache(typeof(BazComponent), "baz")]
109+
public partial class SomeBehaviour : MonoBehaviour
110+
{
111+
void Update()
112+
{
113+
foo.Foo();
114+
bar.Bar();
115+
bazCBaz();
116+
}
117+
}
118+
```
119+
100120
## 生成オプション
101121

102122
`[GenerateComponentCache]`属性のプロパティの値を指定することで、生成コードの設定を行うことが可能です。
@@ -105,7 +125,6 @@ void Awake()
105125
| - | - |
106126
| SearchScope | コンポーネントを探索する範囲を指定します。複数指定された場合はSelf > Children > Parentの順番で探索を行います。(デフォルトはSelf) |
107127
| IsRequired | IsRequiredがtrueの場合、`CacheComponents()`でコンポーネントが見つからなかったときに例外をスローします。また、探索範囲がSelfの場合は`[RequireComponent]`属性を自動で生成します。(デフォルトはtrue) |
108-
| PropertyName | 生成するプロパティの名前を指定します。指定がない場合には対象のコンポーネントのクラス名をlower camel caseに変換した名前が使用されます。 |
109128

110129
## ライセンス
111130

0 commit comments

Comments
 (0)