Object info

Hello
How do you create this.
When your mouse hovers over an object a GUI box appears telling you about the object. Like its name, and cost.
Also you have another GUI buttom on the screen, and when you press it a GUI box appears listing all the objects in the sence that have the tag “object” and it list all the objects and next to the object is its price.
And at the buttom of the GUI it says “total amount = …” and it adds up all the cost numbers.

Thanks

Can anyone help
Please

As with most things there’s more than one possible solution, but:

Give the object a collider. Use OnMouseEnter(), OnMouseExit(), and/or OnMouseOver() to set the value of a boolean variable indicating whether the mouse is currently over the object. When the mouse is over the object, in an OnGUI() function somewhere, display the relevant information on screen.

Use GUI/GUILayout.Button() to create the button. Use GameObject.FindGameObjectsWithTag() to acquire an array of all game objects tagged as ‘object’ (or whatever). Associate a price with each object or object type using the method of your choice (can’t really be more specific without knowing more about the context). Display the list in an OnGUI() function.

Add up all the prices and display them using an appropriate GUI control (e.g. Label()).

Obviously there’s quite a few details involved, but that should at least be enough to get you started.