- Home /
Add object OnMouseDown
I've been searching for answers here in the unity community but I couldn't, it's been frustrating me for a month now. So I'm trying to make a farming simulation game like harvest moon or Stardew Valley, I have a plot, and whenever I want to do something (let's say OnMouseDown), I would like to add an object (this object is a seed and has childrens which later on will turn to plant and fruit), now I'm doing the gameoject.setactive like i did on image 2, but that's not what I want since there would be a multiple plots. I was thinking of snapping it to the center of plot OnMouseDown but I don't know where to start. Can someone please give me any idea? answer would be much much appreciated!
Answer by RePlexOfficial · Mar 27, 2018 at 05:31 PM
What if you just instantiated it?
void OnMouseDown()
{
Instaniate(seedPrefab, desiredPosition, Quaternion.identity, if you want to parent the object, insert parent transform here)
}
Then on the seed prefab do some kind of
void Start()
{
GrowthSimulation();
}
Your answer
Follow this Question
Related Questions
How do I snap/assemble two or more oddly shaped objects together? 0 Answers
Raycast Snapping Problem. 0 Answers
How to snap objects in game 2 Answers
Gizmo won't stop snapping to grid. 1 Answer
Leg snapping backwards on one frame in a 2D blend tree 0 Answers