Instantiating & Destroying Gameobjects

George Asiedu
Jul 26, 2022

--

To make our cube/player be able to shoot, we will add another game object and name it Laser. The laser will be made into a prefab which can be re used when called or instantiated.

Gameobjects that are shown as a bluebox are prefabs:

To Make our player shoot out the laser we will need to call it within our script so it knows what it is going to instantiate:

once this is done we can our prefab to the player within the inspector panel. we will then associate with calling this prefab by pressing the space key:

the new vector will give the a new position rather than the centre of the player which will then make it look more genuine.

--

--

No responses yet