Print DebugLog to a textbox?
I have my code here:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Historie : MonoBehaviour
{
void OnTriggerEnter2D(Collider2D other)
{
Debug.Log("Entered trigger");
}
void OnTriggerStay2D(Collider2D other)
{
Debug.Log("Staying In Trigger");
}
void OnTriggerExit2D(Collider2D other)
{
Debug.Log("Exiting trigger");
}
}
My trigger is a box with IsTrigger enabled. I want the text to appear in a textbox on the screen instead of it appearing in the console. I just dont know how.
I am using C#
Answer by xxmariofer · Feb 13, 2019 at 12:43 PM
create a text object in the editor, add a var to that script public Text textObject; and change the Debug.Log to textObject.text = "Exiting trigger"; and in the inspector click the object who has that scirpt and drag and drop the text you have created to the textObject property.
Your answer
Follow this Question
Related Questions
how to use scientific values in inputfield unit or restrict only some letters 0 Answers
How to link buttons with text,How to link buttons to text 1 Answer
How do I display AudioMixer volume as a percentage 2 Answers
how to convert youtube videos duration time to seconds 0 Answers
Collider trigger two times, even if it's not active. 1 Answer