Advertisemen
Check out our YouTube Channel - Aarlangdi dotKom for short films
Hello guys, I am here with another short tutorial.
Today, I am going to show you guys, how to click on individual object and destroy in unity3d in a easy way with very less codes.
Let's get started. First create a cube from GameObject > Create Other > Cube. Second, create javascript from Project panel, Create > Javascript and name it whatever you like then attach it in the cube you have just created and open it with your favourite script editor.
style="font-size: large;">Now type the following codes in the javascript page you have just attached in the cube.
function OnMouseDown(){
Destroy(gameObject);
}
Thats all you need to do to click and destroy an individual object in unity.
Hope this helps...
function OnMouseDown(){
Destroy(gameObject);
}
Thats all you need to do to click and destroy an individual object in unity.
Hope this helps...
Advertisemen
Tidak ada komentar:
Posting Komentar