Skip to content

Commit 7e629d1

Browse files
Update EntityComponent.cs
1 parent da81faa commit 7e629d1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Runtime/EntityComponent.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ public void SetActive (bool value) =>
4949
public void Destroy () =>
5050
UnityEngine.Object.Destroy (this.gameObject);
5151

52-
/// Sets the value a property to a Unity Component.
53-
public void SetComponentProperty<UnityComponentType> (ref UnityComponentType entityProperty) =>
54-
entityProperty = this.GetComponent<UnityComponentType> ();
52+
/// Gets a component on an enity and sets it's reference to a property.
53+
public void GetComponentToProperty<UnityComponentType> (ref UnityComponentType entityProperty, bool includeChildren = false, bool includeInactive) =>
54+
entityProperty = includeChildren == true
55+
? this.GetComponentInChildren<UnityComponentType> (includeInactive)
56+
: this.GetComponent<UnityComponentType> ();
5557

5658
/// Adds an asset to the entity.
5759
public UnityEngine.Object AddAsset (UnityEngine.Object asset) =>

0 commit comments

Comments
 (0)