Solingen 93

Domestic Violence and Abuse

Unity Create a Game Series (E04. damage system)

Cesar Sullivan

77 thoughts on “Unity Create a Game Series (E04. damage system)

  1. What is the difference between using interface for calling damage, compared to just using SendMessage and/or BroadcastMessage and such?

  2. Ohhh I definitely need a tutorial about shaders, especially that cell shader you used in your Borderlans clone Minilands. Nice video btw. 🙂

  3. hi Sebastian, how I can write pathfinding in spherical world,The reason I want enemies on the spherical world to get away from objects and the search for a better way

  4. Hi, you make so awesome tutorial! I am wondering why the UpdatePath method could be still running altough the gameobject was destroyed!?

  5. this is just what i needed to learn for my project. Are you gonna be covering the part where the enemy shatters into small pieces when they die in this tutorial as well?

  6. Hi. been hooked on your tutorial series. Very entertaining and informative to watch. A little nitpick though with this one 🙂 Its better to use an obj pool for projectiles rather then instantiating them every time you shoot (plus the fly off the level for an eternity thingie). And last, which I guess is just an oversight but the enemy doesn't have a rigidbody which will cause performance issues when it has to update its collision every frame. Really looking forward to future videos. Take care!

  7. Why make Player & Entity inherit from LivingEntity ? As you've shown, it obliges you to override Start() and call the base Start() manually. Why not just make LivingEntity a component and compose Player & Entity with it ?

  8. I am getting an error in the projectile script

    Assets/Scripts/Projectile.cs(32,55): error CS0309: The type `IDamageable' must be convertible to `UnityEngine.Component' in order to use it as parameter `T' in the generic type or method `UnityEngine.Component.GetComponent<T>()'

  9. +Anshu Jalan i had the same problem but i just changed the IDamageable with LivingEntity and it has the same effect (does not bring errors) idk does it affect the game later but for now it works for me 😀

  10. +Putheaith Thao Check out Learning C# Programming with Unity 3D over at Amazon. It's a great book for beginners.

  11. I'm having a problem when adding the layer to the enemy…. he disappears off the scene window.  when I select him in the project tab he pops up but looks like a mesh and no green material, and then when something else is clicked on he again disappears. it doesn't have any affect with anything , just annoyed that I cant see him properly.  any suggestions on what I'm doing wrong.  thanks for any repliesI'm using Unity 5.2.1f1

  12. Hey Sebastian! Great video as always, I'm an avid watcher, but I'm having an issue. A little bit before the 830 mark, you demonstrate how the enemy will disappear if they lose health, but in my program, nothing happens, the bullets pass right through and they don't die. I have everything coded exactly as you do, have the same version as you do, I just don't know what's happening. Any ideas?

  13. Thanks great tutorial as always! Is there any reason why you never use Awake function for getting GameObject's components or some initialization. I'm pretty new to Unity so it's maybe a newbee question. I understand that Start is the right place to be sure that all objects have been instantiated and obvious in lot of your scripts, but is there an overload or bad practices to use Awake and Start together? Thx.

  14. please help, in LivingEntity.cs , it keeps saying Inexpected Symbol 'GameObject' , ive tried to fix but it wont fix!
    ive also checked your code aswell!

  15. Hey guys, this is pretty urgent because I can't continue with this problem. Whenever I try to run the thing (i've done everything up to 8 minutes) i get the error Assets/Scripts/Projectile.cs(36,30): error CS1061: Type `iDamageable' does not contain a definition for `TakeHit' and no extension method `TakeHit' of type `iDamageable' could be found (are you missing a using directive or an assembly reference?)
    and, not only that, I also don't have the option to set the enemy or the players health (like sebastian does at 8:16 )

  16. These tutorials are some of the best I've seen, Sebastian uses many OOP concepts for the ones learning ie. the use of interfaces and the protected modifier, Thanks Sebastian!

  17. :S … Issue:
    Assets/Scripts/LivingEntity.cs(4,42): error CS1721: `LivingEntity': Classes cannot have multiple base classes (`IDamageable' and `UnityEngine.MonoBehaviour')

  18. I have got an erro :`IDamageable' must be convertible to `UnityEngine.Component' in order to use it as parameter `T' in the generic type or method `UnityEngine.Component.GetComponent<T>()'

  19. I have got an erro :`IDamageable' must be convertible to `UnityEngine.Component' in order to use it as parameter `T' in the generic type or method `UnityEngine.Component.GetComponent<T>()'

    I learned your tutorial with Unity4.6,

  20. Anyone with this error? 🙁

    Classes cannot have multiple base classes (`UnityEngine.MonoBehaviour' and `IDamageable')

  21. heehhehe Dont wory if you dont familiar with interface , you will be shortly 😀 Man that was funny 😀

  22. why you use Gameobject.Destroy(gameObject) instead of Destroy(gameobject). Also still somehow bullets miss my enemy :'( times to times not all times but somehow. Not like randomly miss on same angle it miss 100%

  23. For anyone wondering if public startingHealth is necessary, if you just want to let it show up in the inspector, you can actually use
    protected float health;

  24. Bug FREEZE CRASH + Solution:
    So I had a freeze bug that cropped up about 1/3 times I played the game. I traced the problem back to the Enemy script's while loop. I found that putting the two tested conditions (target != null && !dead) into the same conditional statement removed the bug. I've played 10 times crash free. Hope that helps anyone with the same freeze crash I had.

    Also, Sebastian you're great!

  25. Assets/Scripts/Projectile.cs(39,30): error CS1503: Argument `#1' cannot convert `IDamageable' expression to type `float' (im using unity version 5.3.4p6, pls help, thx)

  26. Hi Sebastian, thanks for the great tutorial! I've had a problem though and wonder if you might know what's causing the problem. When I run the game, for some reason the player can't shoot the gun until the enemy is either very close or on him. Shoot then works. I've gone through all the code and checked it's all right and seems fine so must be some kind of setting in Unity. Any ideas?

  27. When you do IDamageable damageableObject = hit.collider.GetComponent<IDamageable>();Does that return the enemy script when the enemy is hit or the IDamageable script attached to the enemy?

  28. Thanks for the great tutorial. One thing I don't understand: IDamageable damageableObject = hit.collider.GetComponent<IDamageable> (); damageableObject.TakeHit (damage, hit); // why would you GetComponent<IDamageable> to access TakeHit() ? Can't we just GetComponent<LivingEntity> ? LivingEntity class also has TakeHit().

    living entity does not implement interface member Idamagable.takehit (float, Unity engine. vector3, unity engine. vector 3

    living entity does not implement interface member Idamagable.takedamage (float)

    projectile cs(33,20) no overload method 'take hit' takes '1' arguments

  30. Hello all and thanks for the tut and helpers too. is someone find how to solve the error message "Assets/Scripts/IDamageable.cs(5,10): error CS0531: `IDamageable.TakeHit(float, RaycastHit)': interface members cannot have a definition"

  31. Hello all and thanks for the tut and helpers too. is someone find how to solve the error message "Assets/Scripts/IDamageable.cs(5,10): error CS0531: `IDamageable.TakeHit(float, RaycastHit)': interface members cannot have a definition"

  32. also, look back on this, would you favor composition over inheritance for the health system? Any time i've tried to use inheritance it tends to get out of control real fast, what do you think?

  33. I was trying to avoid using Unity 5 for this project because it's harder on my laptop than Unity 4.

    The line "IDamageable damageableObject = hit.collider.GetComponent<IDamageable>();" Doesn't work in 4 but does in 5. Why?

  34. I watched "Inheritance" and "Overriding" on Unity3D's website to gain an HUGE understanding of what's going on here. I see the pattern going on here now. At first I was lost and scatterbrained; merely typing and following along. After watching those two videos I have some kind of guidance now.

  35. my player doesn't follow the enemy in direction instantly. it's a bit slow do you know why? and how can i increase that

  36. Why you have to use virtual and override to call base.OverridenMethod() ? Is it fine if without virtual and override keyword just simply call base.Start() in this case? I can see there isn't a compile error.

  37. Why do you need TakeHit method of IDamageable? there is same method in LivingEntity. Why cant we use GetComponent<LivingEntity>? instead of interface?

Leave a Reply

Your email address will not be published. Required fields are marked *