Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

GUI Healthbar not following the enemy

$
0
0
**GUI to world position for GUI Button not working on landscape (Only works on portrait)** ** I'm making the healthbar for enemies. The healthbar works and follows enemies very fine in portrait mode of Android phone. But when i convert it to landscape mode, the positions of healthbars aren't exactly on top of the enemies. ** The healthbars still follow enemies, but their positions are e.g, 1-2 inches away from the enemies (Only happens in landscape mode). For more info, i'm initiating the healthbar (GUI panel and a gui text inside it (not GUITexture)). And while i initiate it, i'm making it the child of my canvas. ** Here's my code, ** void Update () { Vector2 targetPos = Camera.main.WorldToScreenPoint (Enemy.transform.position); EnemyHealthBar.transform.position = targetPos; }

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>