Following the steps under "Required configuration" will allow Unity UI to continue to work in the editor, but it'll also work in the HoloLens using tap and navigation gestures.

Required configuration:

  • If you don't have any UI objects yet, create one (GameObject -> UI -> Button/Toggle/Slider/etc.)
  • Select the EventSystem object (this GameObject is automatically created for you when you create an UI objects, but unlike other UI objects, does not have Canvas as a parent/ancestor)
  • Add the "HoloLens Input Module" component to EventSystem (leave StandaloneInputModule attached for the UI to still work in the editor with mouse and keyboard)
  • Select the Canvas object (this containing GameObject is automatically created for you, and is a parent/ancestor to your UI objects)
  • Change "Render Mode" to "World Space"
  • Drag the Main Camera object onto the "Event Camera" field
  • Remember to put your camera's position at the origin

Recommended steps to get started with a more useable UI:

  • In the Canvas Scaler component of the Canvas object, change "Dynamic Pixels Per Unit" to 10 - this will remove a lot of text aliasing without shrinking the text size too much
  • At the bottom of the Rect Transform of the Canvas object, change the Scale in both X and Y to somewhere around 1/16 (0.0625) to 1/32 (0.03125) or so to make the size of UI objects more manageable (use the same value for X and Y to avoid non-uniform scaling, of course).
  • Set the Canvas position to 0 for X and Y, and a distance of 3-5 or so along Z (this will make it so that your UI is immediately visible after the splash screen goes away)
  • For sense of scale, create a button, masked background, or some other visible UI object and set its width and height to 100 by 100. Make sure you can see this in the Game window, and deploy to the HoloLens as usual. This should give you a better idea of how you'll want to size and position your UI.
  • Create a cursor to more easily tell where your gaze is pointed at (you can use the HoloToolkit to do this pretty painlessly). Especially if you choose not to create a cursor, it's highly recommended that you make the colors, animations, etc., for different states of your UI objects (Normal/Highlighted/Pressed/Disabled) very noticeably different - during initial development, at least - to make it more obvious what you're looking at and whether the gesture was done and interpreted correctly.

Run-time use:

  • Tap gestures of a gazed-at object will act as a quick single-click at that position. The "Time To Press On Tap" field of the HoloLens Input Module component controls the number of seconds that such taps will leave the UI object in the tapped state for better user feedback.
  • Use navigation gestures where click and drag would normally be needed, such as when moving a slider or scroll bar. The "Normalized Navigation To Screen Offset Scalar" field of HoloLensInputModule defines the number of pixels of emulated mouse movement when a value of positive or negative 1 is reported by the device for a navigation gesture.

Known issues:

    • During a navigation gesture interacting with a Slider object, said object's appearance will change between Highlighted and Pressed. The navigation gesture will still work fine during this apparent state-flickering, however, so aside from altered appearance, it should still behave correctly.

Unity UI on the HoloLens的更多相关文章

  1. 关于 Unity UI 中 GraphicRaycaster.Raycast 数量巨大的问题

    有时候会发现 Unity UI 非常耗时,在 Profiler 中可以轻易的看到 UI 中 的 GraphicRaycaster.Raycast 单帧调用可以成百上千,甚至好几千,帧速率前不忍赌,一关 ...

  2. Unity UI 基础【译】

    https://unity3d.com/cn/learn/tutorials/topics/best-practices/fundamentals-unity-ui?playlist=30089 理解 ...

  3. unity UI如何开启(显示)或者关闭(隐藏)Panel界面最好?

    https://segmentfault.com/a/1190000012357091 unity UI如何开启(显示)或者关闭(隐藏)Panel界面,相信大家都是知道的,但是如何做最好呢? 可能大家 ...

  4. Unity UI性能优化技巧

    本文将介绍一些提升Unity UI性能的技巧.更多优化技巧,可以观看Unity工程师Ian Dundore在Unite Europe 2017的演讲<使用Unity性能提升技巧>. 1.划 ...

  5. Unity UI大小动态设置(Resize Unity UI RectTransform)

    我们在开发过程中发现,要调整Unity UI元素的大小,RectTransform提供了sizeDelta属性可以用来动态修改RectTransform的大小,但同时我们也google到另外一个修改R ...

  6. unity UI事件

    由于工作需要到持续按键,所以了解了一下unity UI事件,本文主要转载于http://www.cnblogs.com/zou90512/p/3995932.html?utm_source=tuico ...

  7. unity ui中使用onmouseover

    unity ui中鼠标移进或者移出的触发方式与2d.3d的不同,2d.3d物体使用的是onmouseover,ui使用的是OnPointerEnter.需要实现以下两个接口. public class ...

  8. Unity UI on hololens

    http://heliosinteractive.com/scaling-ui-hololens/ https://forum.unity3d.com/threads/unity-ui-on-the- ...

  9. Unity UI和引用的管理中心

    我们来谈谈Unity的UI, 通常会写一些UI页面,当A页面需要去操作B页面的时候. 至少要获取B页面的引用吧! 一般新人都会在组件的写一个public GameObject UIB页面的属性, 然后 ...

随机推荐

  1. [驱动开发] windbg符号表

    新建"环境变量 - 系统":_NT_SYMBOL_PATH 值为:SRV*FullDirPath*http://msdl.microsoft.com/download/symbol ...

  2. Ruby学习笔记0708

    #!/usr/bin/env ruby class MegaGreeter attr_accessor :names # 初始化這個物件 def initialize(names = "Wo ...

  3. Python为什么要self

    Python要self的理由 Python的类的方法和普通的函数有一个很明显的区别,在类的方法必须有个额外的第一个参数 (self ),但在调用这个方法的时候不必为这个参数赋值 (显胜于隐 的引发). ...

  4. ArcGIS图层介绍

    什么是图层 图层是用来在 ArcGIS 产品套件中显示地理数据集的机制.每个图层代表一种数据集(可以是地图服务.图形或是矢量数据),并指定该数据集是如何描绘使用一组属性的. 包含一个地图控件的每个应用 ...

  5. redis 原子增一的妙用

    有这样一个需求,插入数据库之前需要了解数据库ID号,考虑到不同的主机怎么去协同这个ID呢 同时要保证每个主机分到不同的ID号,这个比较麻烦,如果独立开一个服务来一个C/S操作比较麻烦,幸好REDIS提 ...

  6. appium 执行demo

    appium很早就了解了,一直没有之际操作过,最近把官网的demo搞下来执行了一遍,还是很有意思的 经过测试是可以跑起来的,不过跑得过程中,输入法需要默认为英文的,如果是中文的码输入的时候有点问题,可 ...

  7. Chp11 11.7

    <Java语言程序设计>P327 题目要求使用数组来模拟实现ArrayList的一些方法,并要求可以根据实际长度来实现数组自动增长,这里只贴出LikeArrayList.java 测试方法 ...

  8. 小米note3,华为手机,软键盘弹出之后,页面上定位的元素布局会乱掉

    原因:可能是因为,软键盘弹出时,改变了height,使height:100%,不能达到原来的高度. 解决办法: $(document).ready(function () { $('body').he ...

  9. android驱动开发前的准备(五)

    搭建S3C6410开发板的测试环境 首先安装串口调试工具 第一步:检测当前系统是否支持USB转串口 # lsmod | grep usbserial 第二步:安装minicom # apt-get i ...

  10. html EVENT对象

    Event 对象 Event 对象代表事件的状态,比如事件在其中发生的元素.键盘按键的状态.鼠标的位置.鼠标按钮的状态. 事件通常与函数结合使用,函数不会在事件发生前被执行! onabort 图像的加 ...