Unity3d Beginner On Screen Diagnostic Script

Small Script to display diagnostic information on screen

This script is really useful when developing a plugin for Unity that must be deployed onto a device without the editor. For Example and Android or iOS device.

Script:


using UnityEngine;

public class DiagText : MonoBehaviour
{
    public static string DisplayText = "";

    void Start()
    {
    }

    void Update()
    {
    }

    void OnGUI()
    {
        GUI.Label(new Rect(0, 0, 500, 500), DisplayText);
    }
}

How to Use:

Just enter any string value that will show you the information from any script because display text is declared as static. Also there must be a GameObject added to the scene with the script attached. 
 DiagText.DisplayText = "Some Text";

0 comments:

Post a Comment