HitPoint表示 2
transform.rotation =player.transform.rotation;
プレイヤーの回転と同じにして、常むむきを一定にしてある
-------PlayerGui.cs----------
using UnityEngine;
using System.Collections;
public class PlayerGui : MonoBehaviour {
public GameObject labelPfb ;
public int myHp;
public GameObject labelNameObj;
public Vector3 screenPos;
// Use this for initialization
void Start () {
Vector3 screenPos = new Vector3 (0, 0, 0);
GameObject labelNameObj = Instantiate(labelPfb,screenPos, Quaternion.identity) as GameObject;
labelNameObj.transform.parent=transform;
labelNameObj.transform.localPosition = new Vector3 (0, 2.3f, 0);
}
// Update is called once per frame
void Update () {
}
}
-------PlayerGui.cs----------
ラベルのプレファブ設定

-------EnemyGui.cs----------
using UnityEngine;
using System.Collections;
public class EnemyGui : MonoBehaviour {
public GameObject labelPfb ;
public int myHp;
public GameObject labelNameObj;
public Vector3 screenPos;
// Use this for initialization
void Start () {
GameObject labelNameObj = Instantiate(labelPfb,screenPos, Quaternion.identity) as GameObject;
labelNameObj.transform.parent=transform;
labelNameObj.transform.localPosition = new Vector3 (0, 2.3f, 0);
}
// Update is called once per frame
void Update () {
}
}
-------EnemyGui.cs----------

試してみると、以下のようになる
- 関連記事
-
YouTubeで動画を定期的に出しています。ご視聴いただけると嬉しいです。
Reon Labo
- 2016/11/28(月) 18:00:00|
- Unity
-
| トラックバック:0
-
| コメント:0