events on 3D objects in new UI

I’ve been scouring the internet and haven’t found anything about getting 3D objects to work with the new UI EventSystem, though it seems like it should.

I have put a cube with the default collider as a child of my Canvas (which is set to Screen Space - Camera), I have added an EventTrigger to it (which I have confirmed works with normal UI elements), but nothing is happening.

I have made sure the cube is using the UI layer.
I have tried moving the cube outside of the Canvas.
I have tried using a RectTransform on the cube instead of the normal transform.

None of this has resulted in the cube getting mouse events. Most surprisingly, I haven’t been able to find anyone else asking about making a 3D UI using the new UI system.

You need to add a Physics Raycaster to your camera :slight_smile:

Thanks for the tip, Tim. However, I’m still not getting any events by doing that. As usual, the documentation on the Physics Raycaster is extremely lacking and without examples.

I’ve attached some screenshots of my test scene that I’m using to learn this…

1887111--121422--Screenshot 2014-12-15 10.55.26.png

Ok, after messing around a little more, I realized that if I deactivate my Canvas in the scene, suddenly the cube interaction starts working as intended. This seems like a bug. Why would my interaction with the 3D cube not work while the Canvas (and its GraphicsRaycaster) are active?

(Edit) Actually, that’s not completely true. If I deactivate the Chickadee image, then the cube interaction works. This still seems wrong since the cube is in front of the Chickadee. Strangely, the Cat image doesn’t cause problems with the cube interaction.

Ah ha! In order for the GraphicRaycaster to cooperate with the PhysicsRaycaster, I had to change the “Blocking Objects” setting to either “Three D” or “All” on the GraphicRaycaster.

could you file a bug with your use case and post the case # here. I’m working through making the events play nicer across the different raycasters atm and want to make sure your case is covered.

Sure, where do I post a bug to get a case #?

through the bug reported in the editor.

Ok, I reported the bug, case #657253.

thanks.