Make any item smart
Configure any item to behave like a smart item.
Smart items are just regular items with an Action and/or Trigger component. You can add these components to any item in your scene. You can also import your own custom 3D models and add the same to those.
To add components to an item click the Plus Icon next to the item name, and select what component to add from the dropdown list.

This allows for a huge amount of creative possibilities. Turn a candle into a lever that opens up a secret passage behind a book shelf, play mysterious sounds from inside a well, make diamonds into collectable items that shrink to 0 when clicked. There are tons of imaginative ways to combine these mechanics!
Interactivity
You can make an item react to different actions of the player.
Add a Trigger component, to detect to different actions from the player:
Pointer events: When the player clicks or presses a key while aiming their cursor at the item.
Global button events When the player presses a key, wherever they are in the scene.
Player proximity: When the player walks into the item's position.
The Trigger component can be configured to be aware of any of these types of triggers. Every time a trigger happens, it can call Actions from their own Actions component, or from the Actions components of other items in the scene. See Smart items - Advanced.
Pointer events
Add a Trigger component with On Click or On Input Action Trigger events.
On Click reacts to every time the player clicks the left-mouse button while pointing at the item.
On Input Action reacts to every time the player the Primary Button (E) while pointing at the item.

Colliders
It's important that for an item to be clickable, it must have a Collider. Otherwise your clicks will go right through the model, and try to interact with whatever is behind. The 3D models in the default Asset Packs should all have colliders, but if you create your own model or source if from elsewhere, you may find it's missing one.
If your model is lacking colliders, any of the following should fix it:
Add a Mesh Collider component. This will create a collider with a primitive shape (cube, plane, cylinder, cube, sphere).
Change the properties of the Collisions section on the GLTF component. The Visible layer should be assigned to Pointer.
Edit the 3D model in Blender to include an invisible collider geometry (any mesh with a name that ends in
_collider). See colliders.
Customize pointer events
You can override the default settings that are used when an item has an On Click or an On Input Action Trigger Action.
Hover text: Change the hint that players see next to the cursor when hovering over the item. This can be very helpful for clarifying what your item does.
Max distance: How far away can the player be when interacting with your item.
Show feedback: If unchecked, the item has no hover-hint when the player passes their cursor on it.
Button: If using the On Input Action Trigger Action, you can reassign the default Primary (E) to another key. The hover-hint will include an icon to clarify what key to use. You can use Secondary (F), or Actions 3 to 6 (number keys 1 to 4).
Global button events
Add a Trigger component with On Global Click, On Global Primary or On Global Secondary Triggers events.
On Global Click reacts to every time the player clicks the left-mouse button, anywhere in the scene.
On Global Primary reacts to every time the player the Primary Button (E), anywhere in the scene.
On Global Secondary reacts to every time the player the Secondary Button (F), anywhere in the scene.
Player position
Add a Trigger component with Player Enters Area, Player Leaves Area Triggers events.
This will react to when the player enters or leaves an area of a default size of 1x1x1, positioned at the center of the item.
See also
Last updated