- Home /
Question about Instantiation
I am attempting to implement a building system into a game I'm working on. It needs to have the following properties:
It must spawn an object - which will now be referred to as the "block" - at mouse position when the left mouse button is clicked.
It must show either an outline or a "ghost" of the block at the mouse position before spawning the block.
If there's already an object or another block at the mouse position, then it must place the block above that object.
The block's movement by the mouse position must be restricted by an increment of 1 for every axis of its Vector3.
I wasn't able to find any another topic that helped with exactly this, which is why I'm asking this now.
Answer by salex100m · Jan 02, 2017 at 04:00 AM
You seem to know what you want, so that's good.
1) First try building the instantiate at mouse position 2) Once that is working, get the outline at mouse position working. 2a) Here is how you can do that (one way at least).... use the OnMouseDown and OnMouseUp to distingush between two actions. When OnMouseDown, instantiate the outline object, when OnMouseUp, destroy the outline and instantiate the final object.
get that working first. good luck