Skip to main content

054. Unity3d Tutorial - Targeting 2.0 3/3

See video

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.

Tags:

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Offline
Joined: Jun 3 2011

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!!!!!

Petey's picture
Offline
Joined: Feb 3 2010

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.

Offline
Joined: May 14 2011

The "VitalBar" the MOB does not work, it does not increment, I do not understand why, I just though the steps ....

Offline
Joined: Aug 31 2011

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...

Offline
Joined: Oct 25 2011

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

Offline
Joined: Oct 25 2011

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 ^^.

Offline
Joined: Jan 30 2012

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.

Offline
Joined: Feb 8 2012

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)

Offline
Joined: Mar 19 2012

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