playMaker

Author Topic: [SOLVED] Moving a UI element to a Vector 2 position in World Space  (Read 2804 times)

Splankton

  • Sr. Member
  • ****
  • Posts: 268
Hi,  I have a gameobject at a vector 2 position, and a sprite in the UI.
How can I move the UI sprite to the vector 2 position, from the UI space?
« Last Edit: December 23, 2018, 03:48:42 PM by Splankton »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Moving a UI element to a Vector 2 position in World Space
« Reply #1 on: December 07, 2018, 06:38:56 PM »
Hi,
There is an action called Ugui UI To World Point

It needs a vector 3 tho but you can convert the Vector 2 and to a vector 3 and set z to 0

Splankton

  • Sr. Member
  • ****
  • Posts: 268
Re: Moving a UI element to a Vector 2 position in World Space
« Reply #2 on: December 08, 2018, 12:56:30 PM »
Hi,
Thanks I can't find that action.  Is it the same as Rect Transform World To Screen Point ?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Moving a UI element to a Vector 2 position in World Space
« Reply #3 on: December 08, 2018, 02:53:12 PM »
Hi.
Maybe it is in the ugui proxy full package :)

Splankton

  • Sr. Member
  • ****
  • Posts: 268
Re: Moving a UI element to a Vector 2 position in World Space
« Reply #4 on: December 08, 2018, 03:35:28 PM »
Ok I have it, thanks.  I just cant get it working.  It always give me the wrong positions. I'd like to move the UI sprite over time, to the vector2 position.
The best I got was using the MoveTo action to the destination position, but it moved to the bottom left of the UI rect.
Any ideas where I'm going wrong?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Moving a UI element to a Vector 2 position in World Space
« Reply #5 on: December 20, 2018, 04:28:40 AM »
Hi,

 the UI rect is depending on the layout rules you have applied, so make sure you have centered your Rect and set the pivot to be centered as well, else you might want to make an invisible rect of a 1px size, that is laid out to be centered where you want.

Bye,

 Jean

Splankton

  • Sr. Member
  • ****
  • Posts: 268
Moving a UI element to a Vector 2 position in World Spac
« Reply #6 on: December 23, 2018, 03:48:00 PM »
thanks Jean, thats has sorted it.