New UI EventSystems vs normal coding, or maybe even unity events.

So recently i took notice of the new eventSystems that are used with the new uGUI. The way it works with providing basic functionality for the UI seems straightforward, but to my eyes it looks like this ‘new’ system can provide for a lot of things that we normally use code for.

For instance, in my game when you click on a certain object with a 3d collider a Camera.main.ScreenPointToRay takes place and i check the object and the region for a series of things, etc.

Now with the new eventSystems they have a built in collision check, a physicsRaycast module and whatnot, so it seems i would no longer have to code for input hits, specially with 2D scenes/games. Also, perhaps it could make it easier to build a gui virtual joystic, however there is no -real- documentation to be found on the usage of its many components.
Or rather, you do have the docs:Redirecting to latest version of com.unity.ugui
But no real tutorials on their, i guess, possible vast usage. The live training on Unity Events(delegates) in comparison is way more fleshed out.

If anyone has experience with this or would like to point me in the right direction, i’d be grateful. Unity consistently has hidden gems that no one really knows how to use properly.

For a discussion on UnityEvents check out this thread

I’ve also got a video that shows how to set up physics based raycasting through the event system. It was made for a different purpose, hence the title. But it still shows what you are after.

1 Like

Thanks the video tut was really cool, event triggers look really handy. Originally i wanted to know more about implementing these interfaces, what they really do in the background and therefore how to use them properly.
But given the lack of greater info, your implementation might get me started.

Originally what i was doing was ‘outing’ the hit, the objects position and instantiating a new GO on top of the old one.
Since you can pass raycaster hit as a param, i might have to work around it, but maybe its not needed since the call is already in the object. I’ll have to test a lot of things.

Also, having the raycaster in the camera means i never have to do a Camera.main.ScreenPointToRay ever again?

I’m not sure what that module/script really does or how it works.

Thanks either way,
Cheers