Description
Destroys the parent GameObject
of this Component
. This method is provided to clarify that calling Destroy
on a Component
only removes the component itself, not the entire GameObject
. Use this method when you intend to remove the entire GameObject
from the scene.
Usage
Call this method when you need to remove the entire GameObject
that this Component
is attached to. This is useful in scenarios where the GameObject
is no longer needed and should be completely removed from the scene.
Example
// Example of using DestroyGameObject
public class ExampleComponent : Component
{
public void RemoveGameObject()
{
// This will destroy the GameObject this component is attached to
DestroyGameObject();
}
}