- Home /
This question was
closed Feb 08, 2015 at 05:01 PM by
Chickenator for the following reason:
Duplicate Question
Question by
Chickenator · Feb 08, 2015 at 04:47 PM ·
javascriptraycastraycasthitdamage
How could I apply damage to the player when the player is hit with a raycast?
So I'm making a game and I'm wondering what will be the best way to apply damage in UnityScript. My enemy damages using raycasts and I've tried broadcast message but that only works with children or the same object. How could I apply damage to the player when the player is hit with a raycast?
Thanks in advance.
Comment
I'm c# guy myself but just do a search on "how to reference a variable in another script". When your raycast hits the player pass it back to the players heath script to apply damage.
That reference question get's asked daily so you'll get plenty of results.
@$$anonymous$$mmpies okay thanks just marked my own post as a duplicate