OnMouseDown creates "Screen position out of view frustum" error in Visual Studio

2

How to reproduce:

  • Make a new empty hololens project with a cube in the middle.

  • Deploy it on the hololens and check that it works. I use "Debug/x86/Remote Machine" as configuration.

  • Create a new script and add an empty method called OnMouseDown()

void OnMouseDown()
    {

    }
  • Don't attach the script to anything!

  • Deploy again on the holo lens.

  • The following error pops up in Visual Studio after the app is already runnig on the hololens. Afterwards the app is immediatly closed.

Screen position out of view frustum (screen pos 0.000000, 0.000000) (Camera rect 0 0 1268 720)

(Filename: C:\buildslave\unity\build\Runtime/Camera/Camera.cpp Line: 2626)

The program '[4740] onmousedowntest.exe' has exited with code -2147483645 (0x80000003).

My setup:

  • Windows 10 Pro 1703 (Build 15063.483)

  • Visual Studio 2015 14.0.25431.01 Update 3

  • Unity 5.6.2f1

Am I the only one who gets this error in such a simple program?

I do get a warning from unity:

Game scripts or other custom code contains OnMouse_ event handlers. Presence of such handlers might impact performance on handheld devices. UnityEditor.HostView:OnGUI()

Can anyone explain to me why a script that is not used, with a method that is empty, can create such an error?

hololens
asked on Stack Overflow Aug 10, 2017 by Alfred Doppler

1 Answer

1

You cannot OnMouseDown() (or other mouse events) anywhere in your compiled code base for a Hololens project. Even if the script isn't active in the scene being deployed.

I discovered this on a cross platform Hololens/ARKit project. In my case I wrapped the the OnMouseDown in a #if UNITY_IOS preprocessor directive.

answered on Stack Overflow Jan 29, 2018 by sbgdev

User contributions licensed under CC BY-SA 3.0