![]() Original solution was provided by 'aldonaletto' on unit圓d forum, I dont take credit for this, but I hope this helps you. Unity GUITexture or GUIText not showing up Ask Question Asked 11 years, 4 months ago Modified 8 years, 5 months ago Viewed 11k times 1 Currently I've got a little 2.5D platformer with the camera tracking the player. GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, scale) substitute matrix - only scale is altered from standard Use UI.Text instead Unity - GUIText has been removed Online Code Coaching 7.3K views 2 years ago Every FPS game. Hi there guys, So I am working on a 3d platform game where I need a character with the tag 'Player' to. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers. These properties modify the text in this example: // UI.Text.text example // // A Space keypress changes the message shown on the screen. Use other Text properties such as size, font, and alignment to change the appearance of the text. ![]() ![]() Var svMat = GUI.matrix // save current matrix How to solve the error: GUIText is obsolete: GUIText has been removed. Unity is the ultimate game development platform. Use this to access or edit the message displayed in Text. Scale.y = Screen.height/originalHeight // calculate vert scale Scale.x = Screen.width/originalWidth // calculate hor scale Var originalHeight = 400.0 // you used to create the GUI contents var originalWidth = 640.0 // define here the original resolution If some GUI item Rect uses Screen.width or Screen.height to calculate its position (to align at the bottom or at the right, for instance), substitute by originalWidth and originalHeight. Everything in GUI will be scaled, from coordinates to text and images. In the OnGUI function, the original GUI.matrix is saved and substituted by a new one with the scale modified to keep the original proportions. The original width and height must be defined in the originalWidth and originalHeight variables below. You can set the proportion only to height or width, but the relative position of controls aligned to the right or bottom sides may be clipped or shifted to the left. If you design your controls in the 4:3 format, in a wide screen they will appear stretched horizontally, and vice versa. It's easier, but the problem is when the screen aspect differs from the original. Calculating the coordinates proportionally to the screen size will keep things in their relative places (itens aligned to the right side of the screen will still be right aligned, for instance) but the text itens will not be scaled - in a bigger screen they may seem too small.Ĭhanging the GUI matrix will scale everything. in both SimpleActivatorMenu.cs and ForcedReset.cs paste the following at the top 'using UnityEngine.UI ' where the originally suggested changes from GUITexture to UI.Texture and GUIText to UI.Text, I just removed the UI, as in the post link above //ForcedReset.cs using System using UnityEngine using UnityEngine. There are two ways to reescale GUI coordinates: calculating them based on screen size in the OnGUI routine, or change the GUI matrix to keep them proportional to the screen size. If you resize your screen, the GUI objects remain anchored to their positions relative to the top left screen corner.
0 Comments
Leave a Reply. |