codeswan blog

Game Dev: Box Collider problems

tldr: box collider != box collider 2d. *facepalm*

So I’m dipping a toe into gamedev. Actually I started about a year ago – learning Unity, doing alllll the tutorials, all that. And then I stopped for a while because life (and, you know, actual paying work) and now I’m back. And of course I’ve forgotten everything.

But I’ve learned, over the years, that the best way for me to learn something is to actually have a goal. Tutorials get old quick, especially when they aren’t immediately relevant. So I’m going to hack things together, figure it out as I go, and most definitely fuck a lot of shit up… but in the end, I’m making something I want, and that’s the best motivation of all.

So dirty it is.

The game I’m trying to make is something that I absolutely LOVED as a kid. I mean, we played a ton of computer games, but this is the only platformer I can remember playing all the way through over and over and over again. (Also see: Chip’s Challenge, and Minesweeper. How much you wanna bet Chip’s Challenge is gonna be the next game I try to remake?)

It’s a little shareware game called Pickle Wars. And before you give me some shit about it not being good because you fancy yourself a “real” gamer and blah blah blah… I don’t care, and I’m making it anyways. So there.

Anyways. So after doing some research (aka playing through and drawing out the levels so I can remake them), I started creating it in Unity.

Most of my tutorials up until now have been in the 3D space, so even though this is a 2D game, my automatic instinct was to use the Cube and Sphere 3D objects for everything.

And then this happened:

A post shared by Allison Day (@sushiday) on

So the robot boy asset that comes with Unity is a 2D asset. And little did I realize, the Box Collider 2D (on the robot) won’t collide with the normal 3D Box Collider (which is what the Cube assets for the floor automatically came with). Hence the robot falling through the floor.

Luckily this is a quick fix – just remove the Box Collider from the Floor Tile prefab I made, and replace it with Box Collider 2D. (And do the same for alllll the other prefabs.)

Will I run into other issues from doing it this way? Probably. But does that fix my issues for now? Yep!

Like I said, hacking things together, figuring it out as I go, and most definitely fucking shit up. The best way to learn!

Leave a Reply

Your email address will not be published. Required fields are marked *