Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: IIKII on October 31, 2016, 09:50:33 AM

Title: Unity canvas image to screen position
Post by: IIKII on October 31, 2016, 09:50:33 AM
Hi, I am trying to make a UI image to stay directly on a gameobject in the scene. For example the enemy health bar image above the enemy object.

I can successfully do it using GUI texture but not with Canvas > image. The World to Screen doesn't work. I also tried using Rect transform world to screen but failed too.

Anyone has clear steps to making it work?

Thanks
Title: Re: Unity canvas image to screen position
Post by: jeanfabre on November 01, 2016, 02:48:06 AM
Hi,

 There is a sample showing how to do this on the Ecosystem:

(http://i.imgur.com/J5O0L5W.png)

Bye,

 Jean
Title: Re: Unity canvas image to screen position
Post by: IIKII on November 03, 2016, 11:21:23 PM
Hi thank you that's explains.

But i realized that there's a weird problem of the ugui text appearing in the opposite spot of the gameobject when i turn the camera around. This problem is also with using the normal gui.

Any solution to this?
Title: Re: Unity canvas image to screen position
Post by: jeanfabre on November 04, 2016, 04:37:55 AM
Hi,

 yes. I know about this issue. check using GameObjectIsVisible or IsVisibleInCameraFrustrum ( from the Ecosystem).

 Be careful, the sceneView in editor counts as a camera so is Visible will be true even if not in the game View but in the SceneView.

Bye,

 Jean