unity3d-ui

Horrors of OnPointerDown versus OnBeginDrag in Unity3D

浪子不回头ぞ 提交于 2019-11-29 00:33:25
I'm concerned over the difference between OnPointerDown versus OnBeginDrag in single-finger movement code. (In the latest Unity paradigm of using a physics raycaster: so, finally, Unity will properly ignore touch on the UI layer. So from 2015 onwards what you must do is this: Forget about the crap traditional Input or Touches system which are pointless crap and don't work Add an empty game object with a usually BoxCollider2D, likely bigger than the screen. Make the layer called say "Draw". Physics settings, "Draw" interacts with nothing Simply add to the camera, a 2D or 3D physics raycaster .

How do I put controls on screen?

安稳与你 提交于 2019-11-28 00:30:56
I am working on a project using Unity/Vuforia to build an Augmented Reality app for Android and need some help. I have a ball appear on screen when the imagetarget is found. I cannot figure out how to get the ball to move around. I can use virtual buttons, but am looking to find a way of having the forward/back/left/right buttons (or a joystick) on the android screen which will control the ball. Can anyone offer any advice or point me in the right direction? I've been searching for hours and can only find tutorials for virtual buttons. Nothing that will help me learn to put them onscreen.

Correct 'FlowLayoutGroup' in Unity3D, as per HorizontalLayoutGroup etc

孤街醉人 提交于 2019-11-27 02:15:50
问题 Say you want ordinary flush left flow in Unity UI. Examples: In fact, to answer THIS question I already achieved flush left flow "the hard way". Set out a "vertical group of rows" in Unity autolayout, attach FattieFlow at the top level, public class FattieFlow : MonoBehaviour { public GameObject modelRow; public GameObject modelItem; public void Flow() { screen = GetComponent<RectTransform>().rect.width; // move downwards any which need to be moved downwards int row = 0; while (row <

Unity3D UI, calculation for position dragging an item?

∥☆過路亽.° 提交于 2019-11-27 02:05:46
These days it's incredibly easy to drag UI elements in Unity: Make a few UI items. Add Component -> Event -> Event Trigger . Drop on the script below. Click to add the four obvious triggers. You're done. However. I'm totally lost in the relationship between pointer coordinates and UI coordinates (as seen in RectTransform and so on). In DragIt below: how the hell do you move a UI panel correctly under the finger? Say you have one large panel, with ten UIButton sitting in the panel with Dragster on the buttons. What is the relationship between the RectTransform coords and the mouse pointer ...

Unity3D UI, calculation for position dragging an item?

孤街醉人 提交于 2019-11-26 09:53:55
问题 These days it\'s incredibly easy to drag UI elements in Unity: Make a few UI items. Add Component -> Event -> Event Trigger . Drop on the script below. Click to add the four obvious triggers. You\'re done. However. I\'m totally lost in the relationship between pointer coordinates and UI coordinates (as seen in RectTransform and so on). In DragIt below: how the hell do you move a UI panel correctly under the finger? Say you have one large panel, with ten UIButton sitting in the panel with