- Home /
Transferring Windows Forms buttons and labels to Unity UI (Beginner Level)
Hello. I’m a former foreign language teacher currently on disability and looking to become productive again by eventually producing language learning games for kids. I’ve been playing with computers since 1980 but am a beginner when it comes to C# and Unity.
I’m halfway through the Windows “C# for Absolute Beginners” self learning course and have a text adventure game I’m writing as an ongoing practice project. It started as a console app and now it’s a Windows Forms app that I would like to migrate into Unity.
Specifically, I’m having trouble understanding the button function in the UI, especially the List and Function fields in the Inspector. I’ve referred to the API and the manual but am still confused. Here’s the snippet for the Forms combat button:
private void combat_Click(object sender, EventArgs e)
{
iCombat++; // Click counter initialized at 0
// Call method with each click until player or enemy health <= 0; exits via Message box
if (iCombat == 1)
DoPlayerAttack(); // Resolves combat rolls and displays results in labels
else if (iCombat == 2)
DoEnemyAttack(); // Also resets iCombat to 0
}
I’ve completed the 2D Roll A Ball tutorial and with that information wrote another practice project that’s more or less a complete platformer so I think I have at least a minimal understanding of the UI.
Any guidance, suggestions or referrals to any reference materials would be much appreciated!
Text game: http://www.shastarama.com/adventure.html
Platformer: http://www.shastarama.com/PracticeProject.html
Thank you!
Your answer
![](https://koobas.hobune.stream/wayback/20220612130907im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
I need to move a sprite when an UI button is clicked 1 Answer
Change scene and play it by clicking UI Button? Scene does just load but not start playmode? 1 Answer
UI works in editor, but not on mobile device 1 Answer
I made an resume button, but I don't know how to code it to close my pause menu, any tips? 2 Answers
why won't my add button script work?!? (help appreciated) 2 Answers