3D Platformer in Unity - Enemy Shooting Tutorial

preview_player
Показать описание
In this video, you will learn how to make an enemy object that will shoot bullets at your player. The first thing you need to do is to make a sphere that will be resized to be smaller than the enemy cube. Next, you have to add a script that will instantiate the bullet from a spawn point, which is an empty game object, consisting of only one element - Transform.

The script used in this video describes what exactly is required for an instance of an element to be magically generated. It's a very simple Unity tutorial that can be useful for beginners.

I can help you make an enemy shooting script in Unity, that will follow your player by using a component called AI. The predefined enemy can travel inside the Nav mesh, shooting bullets at a fixed time, causing your player to collect damage and if it collects a lot of damage, the game ends.

If you find this video helpful, consider subscribing. I will make videos every week. This is the sixth video in the 3D platformer tutorial series. Lastly, I will make more game development tutorials and other content related to game industry. These videos will help beginner game developers become better and make amazing games.

Disclaimer: the point of enemy shooting is in entertainment, not in causing physical damage to the player.

Support the Creator of Kozmobot on the social networks!

Music used in the video:
I created my own music.
Рекомендации по теме
Комментарии
Автор

I stumbled upon your channel by accident. Your videos are very interesting, you explain everything briefly and clearly. I wish you a large number of subscribers and good luck. We are waiting for even more videos from you

ivanovilya
Автор

Amazing to applied on Stride Engine. It work!.

CodeDibertzStride
Автор

really helped me out with my 3d fps for enemy AI thank you

MlNERV__
Автор

What kind of game do you hope to make one day?

relarin
Автор

You have to multiply enemySpeed with Time.deltaTime (enemySpeed * Time.deltaTime) because bullet will travel faster or slower for other players because someone can have 70 FPS and someone 50 FPS. Without Time.deltaTime bullet travels per frame, not per second

DevWhisperr
Автор

How close are you to your Microphone?
This dude: Yes

Motyy
Автор

I am unsure why but even after basically copying your script, the enemy is not firing bullets. What do you think the possibility is? It says that a bullet is being fired (bullet is multiplying in the Sample Scene tab) but none is flying out from the enemy

chiiilen
Автор

It only shoots in the X and Z directions. Is there any way to also make it the Y axis ?

elkekeeranders
Автор

Hello, I followed the steps and was wondering why my bullets were not moving. Do you have any ideas?

hithere
Автор

I don't understand why my bullet doesn't shoot, it comes out and falls to the ground or remains floating in the air (with or without gravity)

doll_jinx
Автор

I have an issue, it’s shooting fine now, however the enemy turn. Meaning it only shoots in one direction. Help?

_-VIS-_
Автор

i got an error :
the variable spawnPoint of EnemyFollow has not been assigned

nobody
Автор

why does the enemy cube have another cube as its child object?
Also can the other scripts also be shared

muhammadhabibi
Автор

Make sure to use enemy.SetDestination(player.position), instead of transform.position! Make sure to use Transform instead of GameObject!

kozmobotgames
Автор

I do not get it
My bullets work fine
But they do not go to the player

The_Winning_Gamer
Автор

Hello Guys Very Good Video! But i get this error and I don't know how to fix it. Here is the error code: UnassignedReferenceException: The variable player of EnemyFollow has not been assigned.
You probably need to assign the player variable of the EnemyFollow script in the inspector.
() |THANKS FOR ANY HELP|

markkurucz
Автор

How can it cause damage to the character? Can you make a video?

Tiny
Автор

"SetDestination" can only be called on an active agent that has been placed on a NavMesh"

giddyhaddcock_gaming
Автор

pls make that you can die with the bullet pls it really help alot

someguy
visit shbcf.ru