Learn C# Scripting for Unity (Destroying GameObject)




 Destroying GameObject

The following steps shows exactly how to destroy a 3D gameObject in unity using C#.

Firstly, add a cube from : GameObject / 3D object / Cude , then create a new C# script and attach that script to our cube by drag it and drop it to the cube inspector window .


Open visual Studio editor and tap the following code :


For sure you can't use it like I've wrote it , I only wanted to show the different cases you can use.

Congrats you have just learnt how to make things disappear through coding .

Comments

Popular Posts