Clickable object system for Unity 3D

This is a tutorial series made by Mary D. Kidd, she will add whatever she likes, but you can always ask her about a personal request following the link

Go to Asset Requests page…

Asset Requests

You can read the instructions of use here and download the asset in the Itch.io portal of the author, also, there will be live Demos you can see in there.
This Gameplay System consists of a Game Object with the capability of identify wheter the player hovers the mouse pointer over it, it reacts to clicks and an action will be prompted.
The tutorial is special for those above no0b level in Unity 3D, those who know their way around the Unity interface, inspector and other basics aspects of it.
To begin with the tutorial, it is necessary prepare a GameObject made with a Mesh model imported into Unity 3D (an .fbx from Autodesk, Blender, Solid Works, Inventor, Zbrush, etc.).

Enlarge

1

Unity 3D

In this case, I called it Clickeable Object, I put it in front of a camera so it could be visible for the player. In this demo I used a 2D camera system, but the object keep being 3D, the same with its environment and you can even use it with a 3D rotational camera.

Enlarge

2

Unity 3D

Floating over the Clickeable Object I put another Game Object called “Título” (“title”), made out of a 3D Text object, which possess a Text Mesh Component and displays a floating text in a 3D space without having to use a GUI Canvas.

Enlarge

3

Unity 3D

This text will serve as the title that displays the name of the Clickeable Object, it can be switched for an instruction, advice, icono, graphic or whatever you like and/or need.
Next thing I put the content of the text that displays when you click over Clickeable Object. In this case I used a Unity 3D GUI Text, which requires for you to set an EventSystem and a Canvas on the scene.

Enlarge

4

Unity 3D

All the GUI objects that you may want to display In Game should be inside the Canvas, they can even be anchored by their limits to preserve the Aspect Ratio and the proportions even though the displaying screen change. It´s wonderful!
This interface consists of a gameobject with a Viewport Component, which is inside a gameobject with Scroll Rect Component (Clickable Object GUI), which allows the player to scroll across the content from one side to the other (it doesn´t serve any major purpose here, just for fun and education!). In its contents there is the “cerrar” (“close) button (any normal button in Unity 3D GUI), plus a GUI text object with the content to show and a title (the same with the 3D text). Many uses of this system consists of NPC dialogues and names, interaction advices and more.
A final component of this system is the object “Fondo” (“background”), which gives a better visualization of the content displayed with the mouse click, this with the intention of hiding the rest of the universo besides the text, controls, etc. Moreover, it prevents the player from accidentally clicking over other clickable objects in the scene.
However, the same Viewport component can be modified to supply this same function, even adding customized images. You can opt to anchor the background image to the camera, so it will travel accompanying the player wherever it goes.

Enlarge

5

Unity 3D

With all this objects ready in the scene, you can proceed to add the given C# script “Menu Click On Object” to the Game Object Clickable Object (you can consult how does it works inside of it, just open it with monodevelop).

Enlarge

6

Unity 3D

The things to add in the script are as follows:
Advice- “Título” object.
Info spaces- “Contenido” object.
Blockage- “Fondo” object.
And that´s all! Just click Play and enjoy the game!
Aditionally, you could add a GUI element that indicates a given scene object is a Clickable Object, in this tutorial I used a simple signaling arrow with text, but you can implement whatever you like with better graphics!

Enlarge

7

Unity 3D

Don´t forget to check out the Live Demo and the download Itch.Io page!…

Live demo Clickable object System

Chaozz, ¡Happy codification!

Author´s note: I have begun translating some content from this site so my English speaking friends can enjoy it too! If you have a request for something that is not translated yet, you can ask me here…

Translation requests page…

Translate Requests Page

For now, the only things that will get simultaneously translated will be the Unity tutorials, because there are quite the public for it (I don´t know, but maybe even more than my Hispanic public!)
Thanks for reading and I hope my translation is not too muddy, but If you spot something off, make me know in the comments, and if you can, help me translate other content, I will credit you and even advertise you if you want! ;D

Published by

Mary D Kidd

Una misteriosa creativa dispuesta a dejar sus ideas salir y tomar control del mundo. Preparada siempre para innovar ;D

Leave a Reply

Your email address will not be published. Required fields are marked *

Transcribe Clickable object system for Unity 3D

Your email address will not be published. Required fields are marked *

*

*