Hi, I'n not if it's for unity version or not but I'm using unity 3.3 and seems that somthing isn't correct, seems that this version is calculating the pixelInset differently because using your calculation, my health bar jumps to the center of screen!!!!!
We continue with another tutorial in our Hack And Slash demo made with the Unity3d Game Engine.
In this video, we finish off this wave of edits to our new targeting system.
The "VitalBar" the MOB does not work, it does not increment, I do not understand why, I just though the steps ....
Why i get
BroadcastException: Broadcasting message player health update but no listener found.
MessengerInternal.OnBroadcasting (System.String eventType, MessengerMode mode) (at Assets/Scripts/CSMessenger Extended/Messenger.cs:64)
Messenger`2[System.Int32,System.Int32].Broadcast (System.String eventType, Int32 arg1, Int32 arg2, MessengerMode mode) (at Assets/Scripts/CSMessenger Extended/Messenger.cs:173)
Messenger`2[System.Int32,System.Int32].Broadcast (System.String eventType, Int32 arg1, Int32 arg2) (at Assets/Scripts/CSMessenger Extended/Messenger.cs:169)
PlayerCharacter.Update () (at Assets/Scripts/Character Classes/PlayerCharacter.cs:3)
So what's wrong? Please answer fast...
Prob done something wrong once again... ^^
When I come to the part where you add the: selectedTarget.GetComponent().displayHealth;
I get the following error refering to that line:
Assets/Scripts/Targetting.cs(70,65): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
Regards
Robert
Solved it, must've been a typo... Took a picture of the code, then rewrote it, and it looks exactly the same after rewriting, but now it works ^^.
if someone is having a problem calculating the healthbar position , i omitted the ypos and just calculated the x and it works great. since i see that he revisits this in uitoolkit i am gonna call that good for now.
also many many thanks to the mastermind behind this tutorial series, petey we all owe you a million for this one.
petey, i'm getting this error. Don't know what seems to be the problem
BroadcastException: Broadcasting message Player Health Update but no listener found.
MessengerInternal.OnBroadcasting (System.String eventType, MessengerMode mode) (at Assets/Custom Scripts/CSMessenger Extended/Messenger.cs:65)
Messenger`2[System.Int32,System.Int32].Broadcast (System.String eventType, Int32 arg1, Int32 arg2, MessengerMode mode) (at Assets/Custom Scripts/CSMessenger Extended/Messenger.cs:174)
i get this error too, I don't know what to do
Assets/Scripts/Targetting.cs(70,65): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
please help me







I do not believe that there is a difference between the version of Unity used in this version and the latest version. I do revisit the healthbar code again. We just learned how to implement it using UIToolkit. We will be adding to our project soon.