Jayanam: Unity Set Text On Button Click Event in C# Script

Unity Set Text On Button Click Event in C# Script
I had a request to create a Unity tutorial on how to set a text for a UI Text field when a button is clicked. I show in this show video how to create this simple UI in a Unity scene and then I implement the C# script for the button to set the text for a text field.

The text field can be dragged to a public variable of type UnityEngine.UI.Text and I bind the On clicked event of the button to a public method that I implemented called SetText of the script.

See my social profiles here:
Instagram: https://www.instagram.com/jayanamgames/
Twitter: https://twitter.com/jayanamgames
Facebook: https://www.facebook.com/jayanamgames
Patreon: https://www.patreon.com/jayanam
Merch Store: https://teespring.com/de/stores/jayanam-gamedev

Production Music courtesy of Epidemic Sound: http://www.epidemicsound.com

View on YouTube

Join the Discussion

Share your thoughts, ask a question, or tell us what you learned. Your first comment is reviewed before it appears. Once approved, future comments using the same name and email can appear directly, subject to spam checks.

Leave a Reply

Your email address will not be published. Required fields are marked *

Fix the Blender logo

Drag the loose piece into the missing part. A close fit is enough.

Loading verification…

Keyboard: arrows to move, Shift for fine adjustment, Enter to check. Verification only; movement is not stored. Logo: Blender.