Beginner-friendly, Unity 2D tutorial showing how to set up a basic health system for your player. This video shows how to link your player's health to enemies, so they can deal damage.
📖 CHAPTERS 📖
0:00 - Demo and Project Setup
0:54 - Writing the Player Health Script
2:24 - Writing the Enemy Damage Script
6:04 - Setting up Enemy Damage in Unity
6:37 - Testing the Setup and Outro
💡 IF ENEMY IS MULT-HITTING THE PLAYER 💡
A common problem for some users is that the enemy multi-hits the player, sometimes even destroying him/her right away. Most often, this is because the enemy detects multiple collisions. As set up, the enemy will deal damage for EVERY collider on the player (including child objects of the player). If you want to make sure that only one collision occurs, edit your script to read:
if(collision.collider.tag == "Player").
Adding the "collider" key word, will cause the damage to only be dealt once per attack, instead of once per collider encountered.
🛑 MUSIC 🛑
🔊Running Out - Patrick Patrikios
Support by RFM - NCM: https://bit.ly/2xGHypM
Смотрите видео Player Health System #1: Taking Damage (Unity Tutorial) онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Night Run Studio 11 Апрель 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 29,806 раз и оно понравилось 657 людям.