Reader small image

You're reading from  Unity 2020 Virtual Reality Projects - Third Edition

Product typeBook
Published inJul 2020
Reading LevelBeginner
PublisherPackt
ISBN-139781839217333
Edition3rd Edition
Languages
Tools
Right arrow
Author (1)
Jonathan Linowes
Jonathan Linowes
author image
Jonathan Linowes

Jonathan Linowes is a VR/AR enthusiast, Unity, and full stack developer, entrepreneur, certified Unity instructor, and the owner of Parkerhill XR Studio, an immersive media, applications, and game developer. Jonathan has a bachelor of fine arts degree from Syracuse University, a master of science degree from the MIT Media Lab, and has held technical leadership positions at Autodesk and other companies. He has authored multiple books on VR and AR published by Packt Publishing.
Read more about Jonathan Linowes

Right arrow

Using Unity events for input

Events allow the decoupling of the source of the event from the consumer of the event. Basically, events are a messaging system where one object triggers an event. Any other objects in the project can listen for the event. It can subscribe to a specific function to be called when the event occurs.

Events are a very rich topic, and we can only introduce them here. We will be using the event pattern in various contexts throughout this book, including UI, collisions, and XR interactions. For more information on using Unity events, there are a lot of good references online, including the Unity tutorials at https://learn.unity.com/tutorial/events-uhandhttps://learn.unity.com/tutorial/create-a-simple-messaging-system-with-events.

For this example, we'll create a separate input controller that reads the input button's state and invokes an event and then modify the BalloonController to subscribe to the events. The following diagram...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Unity 2020 Virtual Reality Projects - Third Edition
Published in: Jul 2020Publisher: PacktISBN-13: 9781839217333

Author (1)

author image
Jonathan Linowes

Jonathan Linowes is a VR/AR enthusiast, Unity, and full stack developer, entrepreneur, certified Unity instructor, and the owner of Parkerhill XR Studio, an immersive media, applications, and game developer. Jonathan has a bachelor of fine arts degree from Syracuse University, a master of science degree from the MIT Media Lab, and has held technical leadership positions at Autodesk and other companies. He has authored multiple books on VR and AR published by Packt Publishing.
Read more about Jonathan Linowes