playMaker

Author Topic: GUI that follows a GameObject  (Read 1008 times)

Kirdissir14

  • Playmaker Newbie
  • *
  • Posts: 12
    • View Profile
GUI that follows a GameObject
« on: June 03, 2015, 09:35:58 AM »
Hello everyone,

I have been struggling for quite a few hours now to achieve the following: I want a UI (Panel, Text and some Buttons for example) to follow a gameobject. The Size of this UI element should always stay the same, even when zooming in or out. Therefore I think this can't be solved with a world space canvas.

Cities Skylines is a perfect example for what i want to to. I found a clip which demonstrates this case: https://youtu.be/sUYldERiG9w?t=6m27s

I can't figure out where to start with this problem. Any advice maybe?

Thank you in advance

Kirdissir14

  • Playmaker Newbie
  • *
  • Posts: 12
    • View Profile
Re: GUI that follows a GameObject
« Reply #1 on: June 05, 2015, 03:37:15 AM »
*Bump*

has anyone an idea at all? Is there a way to positiom Camvases in screen space overlay?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: GUI that follows a GameObject
« Reply #2 on: June 05, 2015, 04:13:10 AM »
Hi,


 The Ecosystem has a Sample that demonstrate this:



Bye,

 Jean

Kirdissir14

  • Playmaker Newbie
  • *
  • Posts: 12
    • View Profile
Re: GUI that follows a GameObject
« Reply #3 on: June 06, 2015, 02:01:44 AM »
Hello Jean,

thank you so very much for your help! My idea was quite close to yours, but I don't know why I didn't work out. I still have a strange offset of the Panel but I could fix it with Vector3 Add.

Thank you for this awesome support!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: GUI that follows a GameObject
« Reply #4 on: July 16, 2015, 06:57:11 AM »
Hi,

 it's likely your rect transform set up that is not exactly right, it's difficult to get this when you start with it, so keep playing around with the new UI rect transform, it will make sense once you have experience with it. Make sure you watch as much tut on the new UI it helps.


Bye,

 Jean

gearedgeek

  • Playmaker Newbie
  • *
  • Posts: 29
    • View Profile
Re: GUI that follows a GameObject
« Reply #5 on: May 21, 2017, 06:29:37 PM »
I know this is a old topic but I feel there is no need to start a new when my question deals with this topic.

I noticed that when you turn 180 degree from the gameobject the text is still visible. Is there a way to fix this?

Looking at object
https://postimg.org/image/c5bw1himn/

Looking away from object
https://postimg.org/image/5dlgymtn3/


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: GUI that follows a GameObject
« Reply #6 on: May 22, 2017, 11:29:57 PM »
Hi,

 yes, you are correct, you need to account for the case that the GameObject being following is within the camera view frustrum or not. Use "GameObjectIsVisible" action for this.

 but watch out, in editor, if the gameobject is visible in the scene view it will stay true... it's not just about the gameview ( slightly odd... but once you know about this is ok)

Bye,

 Jean


gearedgeek

  • Playmaker Newbie
  • *
  • Posts: 29
    • View Profile
Re: GUI that follows a GameObject
« Reply #7 on: May 23, 2017, 06:28:48 AM »
Thank you for the info. I didn't think about of using the "GameObjectIsVisible" action. I got it working.