Рет қаралды 10
If you want to spawn game objects on screen tap in Unity, this tutorial is for you! First of all, I have configured my space shooter project with a player that can rotate according to mouse position. The only thing I haven't included in my previous video is how to disable gravity.
This tutorial includes parts that can show you how to disable gravity in order to spawn bullets without any gravity, since the game is a top down shooter. After that, the next part that I need to show you is how to spawn bullets on screen tap. You need to go to your input actions asset and add a Primary Touch Position action.
If you encounter a wrong player direction, you need to add an invoke that will call the function that spawns the bullets. The wall collider that I included in this video is just experimental, I suggest you to add animation for the bullet that will scale it instead of destroying it. This tutorial also includes a script that will teach you how to destroy bullet objects after specific time.
Support the Creator of Kozmobot on the social networks!
CHECK OUT MY WEBSITE: kozmobot.com
INSTAGRAM: / kozmobot.channel
TIKTOK: / kozmobot.channel