How do I make a wooden crate shatter after it’s health goes to zero not on first click?

Updated on November 1, 2017 in [A] Brackeys Courses
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
3 on July 18, 2017

When I tried to follow Brackeys’ Shooting in Unity Video, my wooden crate would shatter when I first clicked it rather than when i shot it 5 times because I set my gun damage to 10 and my crate health to 50. I also followed Brackeys’ video on Shatter Effect to make the wooden crate shatter. Please help if you can. Thanks!

  • Liked by
Reply
0 on October 29, 2017

Can some one please help me with this? Thanks

  • Liked by
Reply
Cancel
1 on October 29, 2017

The “Shattering” i suppose would be an animation, you could simply attach a script that runs per frame that checks the health variable of the gameobject, to then destroy() the object.

If you do want it to shatter, you want to first check the health per frame, when it is 0, you want a shatter animation, and then call a destroy() on the gameobject.

on November 1, 2017

Thanks for responding. I’ll try that when I get the time.

Show more replies
  • Liked by
Reply
Cancel