Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity RemoveComponent

//Use Destroy() for removing components
// Kills the game object
Destroy (gameObject);

// Removes this script instance from the game object
Destroy (this);

// Removes the rigidbody from the game object
Destroy (GetComponent<Rigidbody>());

// Kills the game object in 5 seconds after loading the object
Destroy (gameObject, 5);
Source by forum.unity.com #
 
PREVIOUS NEXT
Tagged: #unity #RemoveComponent
ADD COMMENT
Topic
Name
2+7 =