OnMouseUp() Click Display Effect.


I was wondering how would I go about displaying an object, or a particle effect every time I OnMouseUp() click on the terrain. Similar to a RTS game. When you click on the destination, a particle or object is displayed showing where your destination is. Thank you very much.

I would suggest using a ray cast from the mouse position onto the terrain:

[SerializeField] private ParticleSystem effect;

void Update(){
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if(Physics.Raycast(ray, out hit, 100, LayerMask.NameToLayer("Terrain")))
    effect.transform.postion = hit.point;