GuiTexture as a child

I have a GUItexture as a child of an object. I basically want GuiTexture to follow the object around. BlueCircle is the GuiTexture object.

    Vector3 world = Camera.main.ViewportToWorldPoint(transform.position);
    transform.Find("BlueCircle").transform.position = Camera.main.WorldToViewportPoint(world);

I was doing that in the parent Update(), but it doesn't seem to work how I'd suspect. What is the proper way to have a GuiTexture Child follow the parent?

You don't want the GUITexture as a child of anything; it uses viewport space rather than world space. You want to convert from world coords to viewport coords; see here.

I just faced the same issue and got it resolved by this:


Here o is the instantiated prefab object and IconImgCont is a Child GUITexture of that Prefab.