Hi,
I am working on a card a 2D card game. I want to have a Gui.Box positioned next to the players hand to show their current total. Ideally, I would like this to work for any screen resolution. The players cards are repositioned during game play. I have tried the following, but with no success.
NewPositions is a generic list of vector3’s. I was just testing with the first element. I am not sure what I am doing wrong. I am trying to follow examples that I saw on this forum. The GUI.Box is not placed near the GameObject. Also, if I test it with the screen maximised, then the GUI.Box is in another position. I am positive that NewPositions[0] is populated correctly. I would appreciate any help.
Vector3 V = Camera.main.WorldToScreenPoint(NewPositions[0]);
V.x = Screen.width - V.x;
GUI.Box(new Rect(V.x, V.y, 40, 40), new GUIContent(PlayersTotal), GameControl.Instance.ButtonStyle);