Nerd For Tech
Published in

Nerd For Tech

Fun with Unity3D: How many can it explode before it breaks?

Having fun with unity should always be at the core of any project you make, whether it is a game project or even a software project.

So I had this idea that exploded in my mind at night and woke me up: How many barrels can I explode before Unity breaks?

Preparation

For quick prototyping, I downloaded the Barrels 3D prop and the Big Explosion VFX from War FX from the Unity Asset Store. Assembled a quick room and the C# script to control barrel position on start and to Instantiate the explosion with randomness. The barrel has a collider and a Rigidbody affected by gravity.

Barrel Script

10 Barrels

Let’s start simple with 10 barrels.

Smooth Explosions

25 Barrels

Everything is still smooth

100 Barrels

Still running smoothly and maintaining 60fps although there is a big dip in fps when the barrels explode.

500 Barrels

Let’s increase the randomness for the explosion routine in order to space out the explosions and see the difference.

Unity starts to struggle trying to simulate all the collisions and explosion.

1000 Barrels

Can it hold?

That almost broke it, very choppy reaching 1FPS at times

5000 Barrels

This is the ultimate test….here comes the big kaboom.

I couldn’t even record a GIF properly, it took unity 1 min and 40 sec to start the sequence
Reaching 0.1 FPS, Unity almost broke but kept going.

Unity did not crash, my GIF recorder actually crashed. It took Unity around 10 minutes to explode all the barrels and normalize.

This was a fun experiment, just keep in min that it was done using URP and without any optimizations.

Barrels of doom

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mohamed Hijazi

Mohamed Hijazi

142 Followers

A knowledge seeking biologist who is following his passion into a full time career in Unity / Game Development. https://www.linkedin.com/in/mohamed-hijazi/