Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

how can i add a new object on terrain by a mouse click in the same position ?

Discussion in 'Editor & General Support' started by unity-enn, Sep 4, 2018.

  1. unity-enn

    unity-enn

    Joined:
    Sep 4, 2018
    Posts:
    3
    i want to add a new object ( instantiate it ) on terrain by a mouse click, in the same position (X,Y,Z). i want to do as when we want to add a tree on terrain the position is colored and the tree is added in the same position. i used this script, but the object is added in other position, can someone help me ?
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Are you just trying to piss people off by tagging this question with completely unrelated tags? What does your question have to do with licenses and memory management? Why piss people off that you are trying to get to help you?

    If you have a script already, you should post the script into the forum using CODE tags. Describe the problem in more detail, what you want to occur, and where you think the problem is in your script. If you want someone else to write the script for you, you should just hire someone for the work. Try Unity Connect as far as around here.
     
  3. unity-enn

    unity-enn

    Joined:
    Sep 4, 2018
    Posts:
    3
    using UnityEngine;
    using System.Collections;
    public class ajoutermine : MonoBehaviour
    {
    public GameObject mine;


    void Update()
    {
    if (Input.GetMouseButtonDown(0))
    {
    Vector3 mouse = Input.mousePosition;

    Instantiate(mine, mouse, transform.rotation);
    }

    }
    }