Answer the question
In order to leave comments, you need to log in
How to create a button through Unity script?
How to create multiple buttons in a panel with Grid Layout using a script? I also used this script, but the button is created larger than the whole screen:
GameObject btn = new GameObject();
btn.AddComponent<CanvasRenderer>();
btn.AddComponent<Image>();
btn.AddComponent<Button>();
btn.transform.parent = panel.transform;
Answer the question
In order to leave comments, you need to log in
I don’t know exactly how, but in the code I don’t see any reference to Grid Layout at all
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question