function Update(){
var screenPos :Vector3 = camera.WorldToScreenPoint(target.position);
//print (“target is " + screenPos.x + " pixels from the left”);
print (“target is " + screenPos.y + " pixels from the top”);
Positionx = screenPos.x;
Positiony = screenPos.y;
}
function OnGUI (){
GUI.skin = GuiSkin;
my problem is my positiony takes from the bottom of the screen and not the top… so the healthbar is not over my gameobject. if my gameobject is 10px from the top… my healthbar is 10px from bottom… any ideas how i can fix this problem?
get rid of transform and it might work, that means that your referencing the target an the gameobject that the script is attached to at the same time, which you arent supposed to do.
that that gets rid of position error.
but these are still there:
Unknown identifier: ‘Positionx’.
Unknown identifier: ‘Positiony’.
EDIT: Maybe its because the script calls OnGUI first and then Update?