Hello Guest

Author Topic: GUIText Positioning in GameObject  (Read 5860 times)

ephro

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 2
    • View Profile
GUIText Positioning in GameObject
« on: August 16, 2013, 02:15:33 am »
I'm trying to use an Empty Game Object to make a prefab. For the text in it I am trying to use GUIText. When I make the prefab then position it on the screen the GUIText object moves much farther than the rest of the objects in the PreFab. For example if I move the GameObject 10 pixels the GUIText probably moves 1000 pixels in the "Game" window.

I set my Pixels per meter to be 1, I tried setting my origins to bottom left and center. I tried changing the scale parameters of the GUIText, but nothing makes it work.

Is there something I am missing?

int64

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: GUIText Positioning in GameObject
« Reply #1 on: August 16, 2013, 02:45:06 am »
I don't use GUIText in Unity - I am using tk2dTextMesh in this purposes for GUI dynamic (and some static) texts, in other cases i use text as sprite.
I don't know about GUIText, but:
1) all texts with tk2dTextMesh costs 1 draw call as they have the same material (for many fonts - simple pack it all in one spriteCollection)
2) I use GUI functions only for debugging because GUI elements drawing costs one draw call per element
3) text alignment (and other gui elements) is very simple: I use my custom component for that, but tk2d package contains the same component (tk2dCameraAnchor)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: GUIText Positioning in GameObject
« Reply #2 on: August 16, 2013, 10:05:31 am »
int64 is correct, you're better off using tk2dTextMesh.
GUIText uses a different coordinate system. While its possible to get it to work in sync, it probably isn't worth the effort. If you absolutely need to use the Unity text system for some reason, use 3D Text - it will be possible to position that in 3D space, making it a lot easier.