- Home /
4.6 - Sceneview GUI.Button not working correctly
I've been working in 4.6 for a little while however have come across a problem as I went to use GUI.Button within a custom editor.
Rather than the standard GUI button, it looks like it's attempting to pull off a new unity UI. On top of this, it's only rendering in the top right quarter of my scene view.
Here you can see where I'm trying to draw buttons where each of those objects are, they appear as if they're the new UI.
On top of that, it's not taking in screen coordinates, instead it's treating them as world coordinates.
for (int i = 0; i < allReactions.Count; i++)
{
Vector3 screenPos = allReactions[i].transform.position;
if (GUI.Button(new Rect(screenPos.x - 10, screenPos.y - 10, 20, 20), "Connect"))
{
}
}
Thanks for any help. I'm pretty sure this is a bug but I'd thought I'd ask here in case I am missing something.
Answer by Randomman159 · Nov 09, 2014 at 04:20 AM
Surrounding the loop with Handles.BeginGUI() and Handles.EndGUI() solves this issue.
Your answer
![](https://koobas.hobune.stream/wayback/20220613171049im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do I switch screen view to another view/window? 1 Answer
Unity 4.6B UI Scrollbar Usage 1 Answer
When I pause my game and enable canvas and then resume my keyboard starts controlling the menu... 1 Answer
GUI 4.6 Toggle Question. 0 Answers
New GUI - nomenclature of blueprint (b) vs Raw (R) 0 Answers