- Home /
how to do in-game drag and drop GUI
I want to make a GUI which allows for drag-drop behavior.
I have started out using GUILayout.box() and planned to use the 'Input' functions to detect mouse input, but I could not find a way to get the coordinates of the elements when using GUILayout. I can see the GUIElement object exposes it's Rect which would be useful but I can't find a way to retrieve the GUIElements from the GUILayout.
I then considered using GUI instead of GUILayout but that would require rolling my own layout system, just to get object coordinates. Then I discovered GUITexture, which seems useful but doesn't seem compatible with GUILayout either.
What is the best way to implement drag-drop GUI?
Edit: I have just found MonoBehaviour.OnMouseDrag, maybe using this with GUITextures is the way to go?
Your answer
Follow this Question
Related Questions
Grid layout lags after thousand inserts. 0 Answers
GUI layering 0 Answers
GUI button adjustments 2 Answers
Get height of a group of GUILayout controls 1 Answer
How do I set the order of elements in Canvas (Screen Space - Camera)? 0 Answers