It is very useful to create applications in the Fedora 33 Linux distribution with the Unity 3D game engine.
In today's tutorial, I will show you how to build the simplest GUI with C# and a dynamic button.
To create a button dynamically you need to use GUI.Button.
Open Unity 3D new project in your Fedora 33 distro.
Add a new Game Object by right click and select Create Empty.
Select Game Object use Add Component to add a New script and name it create_button.
Open it and add this source code:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class create_button : MonoBehaviour {
void OnGUI()
{
if (GUI.Button(new Rect(10, 10, 300, 20), "Test - Dynamically button"))
{
Debug.Log("Test button");
}
}
}
If you run the Unity project you will see a basic Unity 3D button, see the next image: