Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Resolved Text to Grid?

Discussion in 'Scripting' started by Roulace, Jul 8, 2021.

  1. Roulace

    Roulace

    Joined:
    Feb 5, 2017
    Posts:
    27
    I'm trying to make a grid of numbers/strings. Currently, I'm keeping track of the numbers via a matrix, and drawing the lines of the grid using Debug.DrawLine. I'd like to display the numbers on the grid, but can't find an easy way to do that in a script.

    The only tutorial I found is from Unity 2019, he used "UtilsClass.CreateWorldText(...)", but UtilsClass no longer exists?

    The numbers don't need to display outside of debug mode, but I do want them positioned in the grid.

    Any ideas would be greatly appreciated.
     
  2. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
  3. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
    Also, if you only want to use it as a debugging tool, I would suggest Handles.Label instead
     
  4. Roulace

    Roulace

    Joined:
    Feb 5, 2017
    Posts:
    27
    Handles.Label requires OnSceneGUI(). I've never used OnSceneGUI() or anything like it. I'll look into it. Is it possible to generate & change the numbers using Handles.Label, like over time rather than on button prompt?

    Thanks for the quick reply by the way.
     
  5. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
    It's actually meant for over time, not for buttons, it's a debug only thing. Handles are for example the arrows you see when you are moving an object in the scene view.