Skip to content

Commit ef781a6

Browse files
Added Destroy method to entities
1 parent d83923d commit ef781a6

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Runtime/EntityComponent.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ private void OnDisable () {
4141
private void OnDestroy () =>
4242
this.GetSystem ().Internal_RemoveEntry ((EntityComponentType)this);
4343

44+
/// Sets the game object of the entity active.
45+
public void SetActive (bool value) =>
46+
this.gameObject.SetActive (value);
47+
48+
/// Destroys the game object of the entity.
49+
public void Destroy () =>
50+
UnityEngine.Object.Destroy (this.gameObject);
51+
4452
/// Adds an asset to the entity.
4553
public UnityEngine.Object AddAsset (UnityEngine.Object asset) =>
4654
UnityEngine.Object.Instantiate (asset, UnityEngine.Vector3.zero, UnityEngine.Quaternion.identity, this.transform);
@@ -94,10 +102,6 @@ public void SetLocalScale (float x, float y, float z) =>
94102
public void AddLocalScale (float x, float y, float z) =>
95103
this.transform.localScale += new UnityEngine.Vector3 (x, y, z);
96104

97-
/// Sets the game object of the entity active.
98-
public void SetActive (bool value) =>
99-
this.gameObject.SetActive (value);
100-
101105
/// During the 'InteralOnUpdate' the entity component will invoke its
102106
/// 'OnEntityEnabled' and 'OnEntityInitialized' if needed.
103107
[Internal]
@@ -112,4 +116,4 @@ public void Internal_OnUpdate () {
112116
}
113117
}
114118
}
115-
}
119+
}

0 commit comments

Comments
 (0)