From 3D Prototype to 2D Assets, Part 2 — Convert 3D GameObject to 2D
Last time we got as far as our Background, and our game already pops. But to be truly 2D, the rest of our 3D assets have to be converted.
We’ll go through 2 ways to convert 3D GameObjects into 2D. We’ll have some bugs to fix, and that will be the topic of Part 3!
Converting our Player; starting from Scratch
Sometimes, starting from scratch is a much better path to take. Thankfully, there is not much on our Player and it is not very intricate to rebuild in 2D form.
The most important part of our Player right now is the Player Script attached.
And since we have that Script in a folder, ready to be used on ANY object, we can just delete our Player from the Scene Hierarchy and start new!
Now, a blank canvas, we can bring in a Sprite image of our NEW Player, and drag it into the Scene Hierarchy (and remember to re-name it too!):
This is essentially our New Player Game Object. It’s just a little incomplete right now. For one, it doesn’t have a Player Script attached. The other important parts are the Box Collider 2D and Rigidbody 2D (so that the Player can interact with other 2D objects).
You must remember to use the 2D versions of the Box Collider and Rigidbody. This is important later when interacting with the code!
- Remember to set the Collider to a trigger
- and for the Rigidbody, make sure the Gravity scale is 0!
Converting our Laser Prefab; convert from the inside-out.
Sometimes, you want to keep your Prefab intact and not create a new GameObject from scratch when converting to 2D. That’s fine too, you just have to remember everything!
For this, we’ll jump into the Laser’s Prefab window by double-clicking the Laser Prefab in the Project Window.
Now we can delete every component, EXCEPT the Laser script:
Then just like previously with the Player, we add a Box Collider 2D and a Rigidbody 2D.
Then the important part is to add a Sprite Renderer — this allows us to drag a sprite onto the object, that we can actually see! Our Laser would be invisible without our renderer!
Now that we can see our Laser, we can fix up the Box Collider 2D to fit the sprite appropriately!
And GRAVITY SCALE:
Well, this one is up to you. You now can choose a preference in which method you like to use.
For me personally, I chose option 2 because it was already a Prefab. But you can create an entirely new Enemy GameObject if you want!
We have the Sprites converted to 2D, but unfortunately that’s not the end of our conversion process! We still have some bugs to fix:
We solve those in the next section!