C# Destroy in Unity! - Beginner Scripting Tutorial

preview_player
Показать описание
Watch this video in context on Unity Learn:

How to use the Destroy() function to remove GameObjects and Components at runtime.
Рекомендации по теме
Комментарии
Автор

Thank you unity for making these. I'm quite new to c# so very helpful.

vaishnav_mallya
Автор

I really really love the way u guys explain everything there... I no nothing but u make me no something... Good job.. My boss

aymkgamigvituallimit
Автор

Thank you for this simple explanation!

dan
Автор

When I do Destroy(this) or Destroy(ObjectReference) where that is a serialized variable linking to the gameobject, it never destroys the gameobject. I can see it, and the script is still there too. Destroy seems to do nothing for me.

JonTopping
Автор

What's the advantage of destroying a component? E.g. why not just disable it while it's not needed: e.g. = false;"?

gregoryfenn
Автор

is there a way to delete a clone of an object? (Instantiate) without deleting the original?

athsmooth
Автор

Hi, thanks for the tutorial. I have a question: How is it done if the objects I want to destroy are in 2D (not 3D), and if I want to destroy them by clicking with the mouse?

sandraeriusand
Автор

The 3f didn't work for me my enemy disappeared as soon as it died i want the death animation to play first and the body to stay for sometime the disappear

KBforJesusChrist
Автор

When I do this I get an error saying trying to access gameobject failed because I destroyed it so how on earth do we make bullets

hurried_coder
Автор

Sir, my console says there is nothing called game object.

esam
Автор

any idea how i can reference destroy mutiple game object by trigger?

dcry
Автор

Hi 👋, how do you write a script sequence to destroy all the gameobjects, like 10+ gameobjects by assigning number order for each of one in runtime then press button to destroy it in sequence. THANKS 😊

hartangl
Автор

how can i do this with a touch gesture like "pinch in"?

imSoo_OP
Автор

for some reason it does not delete a cube it is attached to

superangryowen
Автор

thank you from cali homeschool mom and 16 yo.

anaislake