Converting OnGUI function to UI

I found some scripts about making dialogues in game, but these scripts use old GUI, and now i need to convert it to UI. Could somebody please help me with this?

Link:Script which to convert

Other scripts related:

I appreciate any help, guys.

You can’t convert an IMGUI (OnGUI) script for the new UI. The new UI consists of GameObjects added to a canvas GameObject, with positions and dimensions set in the respective transform components. Events like having clicked on a button are set using the UnityEvents that are displayed in a component’s inspector.
In other words: Half of what this script does is not done by scripting in the new UI, and the other half depends on how you designed the first half.

I’d recommend either

  • understanding the script you found and re-implementing the idea behind it or
  • trashing the script and start from scratch.

The good news is: The new UI is surprisingly intuitive and fun to use once you get the hang of it. Instead of one complex OnGUI function, you can implement a lot of things with a few one-liner scripts that you attach to the right UI objects. Here’s the tutorials section for the new UI to get you started: Learn game development w/ Unity | Courses & tutorials in game design, VR, AR, & Real-time 3D | Unity Learn