Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Making text inside of cubes

Discussion in 'Scripting' started by B-Freak, Oct 5, 2011.

  1. B-Freak

    B-Freak

    Joined:
    Sep 22, 2011
    Posts:
    7
    Hi my problem is this:

    I am trying to make a game where the game spawns 4 cubes at the beginning which are moving towards the player. I want text/numbers on/inside the cubes like there are question marks on cubes in mario and so on..

    it is easy enough to make 3d text that follows the cubes but that seems like an ugly solution ?

    I am making the game in 3d :)
     
  2. ivkoni

    ivkoni

    Joined:
    Jan 26, 2009
    Posts:
    978
  3. B-Freak

    B-Freak

    Joined:
    Sep 22, 2011
    Posts:
    7
    I can see that the shader makes it possible to have text behind objects and so forth. But i want the text to be written on the box and follow it as the box moves around.
    At the moment i have tried to make a 3d Text object child of the cube but when i move the cube the text is moving too fast.
     
  4. B-Freak

    B-Freak

    Joined:
    Sep 22, 2011
    Posts:
    7
  5. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    Does the text have to be 3D? Why don't you just texture the cube to have the words on it?
     
  6. B-Freak

    B-Freak

    Joined:
    Sep 22, 2011
    Posts:
    7
    i have to have the ability to dynamically switch the text on them.
     
  7. bdev

    bdev

    Joined:
    Jan 4, 2011
    Posts:
    656
    are you setting the ahcnor to center middle as well as alignment? Depending on the cube's pivot if its int he center after making the 3d text's alignment and achor correct it should be as simple as just setting the text as a child of the cube and localPosition = Vector3.zero.
     
  8. B-Freak

    B-Freak

    Joined:
    Sep 22, 2011
    Posts:
    7
    I have tried doing that but when i pull my cube to the sites the 3d Text is not following perfectly. The text is always in the middle of the cube when i set the cube to its start position, but when i move it, the text will always be to the site of the cube.
     
  9. B-Freak

    B-Freak

    Joined:
    Sep 22, 2011
    Posts:
    7
    Actually i can see that in the "scene view" it is always inside the cube, but in the "game view" it isn't catching up as described.
     
  10. karthik t s

    karthik t s

    Joined:
    Mar 23, 2013
    Posts:
    1
    Please guys same problem for me also... i want 2d text on a cube