Destroyable Box

I have a cube which i have applied a cardboard box texture to it, how do i make it so the box can be destroyed upon mouse click?

What JavaScript should i use. Thanks

1 Answer

1

What texture you've applied (if any) doesn't matter for this particular problem.

The solution should be fairly straightforward though: it should just be a matter of adding an appropriate collider to the 'box' game object, adding a script that implements the OnMouseDown() function, and calling Destroy() with the game object as the argument in the body of the function. (I haven't actually tested this, but it seems like it should do what you're wanting.)

Do you got an example script? also is it possible to play an animation such as the box' been destroyed not just it disappearing lol .. thank you