Made With Unity | 2D Space Shooter Part 6: Assets Upgrade
In this series of article / tutorials we are going to be making a small 2D Space Shooter using Unity3D and later on using the New Input System.
Up until now we are making a game in a prototype phase, just using 3D object giving to use by Unity and testing the code and logic before adding assets. Now the next step is to upgrade our prototype scene in using actual asset to make our game look good.
NOTE: Ill be using asset from Filebase, a membership to get thousands of ready-to-go game assets built for Unity. In this article I will show how to use Free assets from the Unity Store and other places that I personally use. Later on I will be using my own asset and it will look different from your project BUT the steps and logic work the same regardless on where you get your assets.
Getting Free Assets
THE UNITY ASSETS STORE
Go to assetstore.unity.com, sign in using your Unity ID.
Your going to get 3 free asset to use on the 2D Space Shooter
Production Crate is a free and paid membership page where you can get assets in like video effects, audio background and audio effects. The free membership allowed you to download 5 time per day, so be caution and be sure what you are downloading.
Open a free account, on the search bar write Outer World and select the one from the Sounds + Music. Download the file as a WAV file, remember where you store the file.
Assets on Production Crate that have a star next to the file name can only be download if you are a Pro member.
Getting The Asset On Unity
On Unity go to Windows -> Package Manager. On the Package Manager window select My Assets and type the name of the asset you want to download / import on the search bar, hit Download or Import wait for it to download and again it Import. Do this for all the assets we acquire from the Unity Asset Store.
On the Project tab / window create two folders one named Audio and the other name Background, the Background folder must be inside the Audio folder. Right click on the Background folder and select Show in Explorer, your explorer window will open, more the Outer World wav file inside the Background folder.
Upgrading The Project
Look for the 2DSpaceshipsFreeTrialAtlasTopViewBlue_0 on the 2DSpaceshipsFreeTrial folder and drag the Sprite on to the Hierarchy.
Add the following components: Box Collider 2D and the Player script.
Make sure that Is Trigger is checked, and Player script is filled with the proper information (Speed is 4, drag the Laser Prefab to the Laser Prefab filed, drag the [ — LASERS CONTAINER — ] game object to the Lasers Container field). Delete the Player (Cube) and rename the 2D ship Player and change the tag to Player
Drag the Laser prefab to the Hierarchy, remove the following components: Capsule(Mesh Filter), Mesh Renderer, Capsule Collider and Rigidbody. On the Inspector, on the top, open Overrides and press Apply All.
Add the following components to the Laser prefab: Rigidbody 2D (makes sure Gravity Scale is 0), A Sprite Renderer (drag the sprite ScifiFighterWeaponAtlas3 from the 2DSpaceshipsFreeTrial folder) and a Box Collider 2D(check the box for Is Trigger).
Make the following changes on the Laser Transform, once again go to Overrides and select Apply All; now you can delete the Laser from the Hierarch
The Enemy has the same steps as the Laser prefab; drag the Enemy prefab to the Hierarchy and remove the following components: Sphere (Mesh Filter), Mesh Renderer, Sphere Collider and the Rigidbody. Add the following components: Sprite Renderer, Rigidbody2D and a Box Collider 2D; Box Collider 2D Is Trigger will be checked and the Rigidbody2D must have the Gravity Scale at 0. For the Sprite Renderer will select 2DSpaceshipsFreeTrialAtlasTopViewRed_1. Apply All the changes on the Overrides section. Remove the Enemy prefab from the Hierarchy.
Create a new Empty Object and called it Background and add a component of Sprite Renderer. From the Free Galaxy Background folder or from the Sprite Renderer component select Galaxy 09. On the Sprite Renderer make sure that the Order in Layer is -10, since we are working with 2D asset the -10 will make sure that the picture will be on the lower view and the ship will appear in the top view.
UPDATE THE ENEMY SCRIPT
The only change on the script will be on line 25, since we are changing from 3D asset to 2D asset the Collider component are going to be 2D.
🎮PART 7 🎮