Search Unity

trouble with gui need to set it to a object

Discussion in 'Multiplayer' started by dr-mad, Mar 20, 2010.

  1. dr-mad

    dr-mad

    Joined:
    Feb 15, 2010
    Posts:
    19
    hi i use the networking style of onlinewith the server and stuff but

    i use the third person example

    but now i have a guiText and a GuiTexture

    and i add it as a prefab the player and the gui's

    but when i start it up and make connection it dont set the gui to the object in the unity editor i need to set it up by myself so i need to connect the gui by hand

    is there a way when i start up my game i can set it with a script (Javascript) to my player im talking about the gui in the hierarchy to the object in the hierarchy or something


    or use a sendMessage or any kind of help

    i hope this is a bit to understand because im not english ;)

    greets dr-mad
     
  2. hound0999

    hound0999

    Joined:
    Jun 30, 2009
    Posts:
    124
    well I think what your asking is if you can set some type of texture or image to appear on another player. I think you should look in to using a TextMesh and setting the texture with TextMesh.guiTexture.
     
  3. dr-mad

    dr-mad

    Joined:
    Feb 15, 2010
    Posts:
    19
    mayby i understand you wrong or i type wrong

    it add my player prefab as the world start and then its online but i have a gui health and some other stuf

    but it dit not set my GUITexture in the object hierarchy

    now when my player is added is there some way for me to set the GUI objects like Text and Texture to the player that is my player


    the things that are added to the game when a new client is set is my player prefab and the GUI with al my gui's in it like the text and textures

    but in my project the player prefab and the gui prefab is set that its connected to each other but in the game the gui just dissappear

    and they no longer are connected


    do someone have this problem or know how to solve it


    // this is in my player prefab and the GUIText is
    // my gui object that i can set to my player
    var firstGUI : GUIText;

    thanks hound0999 for reading and awnser but i dont know if that work but what i now have is the same i think or i be mistaking

    but thanks for reading this i hope for some awnsers

    and greets dr-mad ;)
     
  4. hound0999

    hound0999

    Joined:
    Jun 30, 2009
    Posts:
    124
    Ok I'm going to ask this to make sure there is no communication problem. Do you want text to be shown above another player when using online networking?
     
  5. dr-mad

    dr-mad

    Joined:
    Feb 15, 2010
    Posts:
    19
    now i have added my gui objects to my game but i im trouble with the gui

    normaly the gui stay in 1 place and did not move

    now they are added to my player and when my player moves the gui dos to and then they did not stay in the camera if i move

    is there a way to keep the gui on place when my player moves i try a script update function

    transform.position.x = 0;
    transform.position.y = 0;
    transform.position.z = 0;

    but that is to buggy

    is there some way to not move my gui when my player moves

    because its gui objects are in the player

    thank you ;) for reading

    greets dr-mad