I am trying to add new object on touched location of GameObject (base plane) , I am unable to get the exact touch location where user clicked . the new object will not be child of base plane , that will be child of another GameObject which is present in base plane.
I tried using with raycast but it didn’t work well , able to add object but not the required(touched) location.
Vector3 dustbinLocation = new Vector3(raycastHit.transform.position.x, 180.0f, raycastHit.transform.position.z);
GameObject newDustbin = Instantiate(singleDustBin, dustbinLocation, Quaternion.identity);
newDustbin.transform.SetParent(dustBinPrefab.transform);
May be it is a small question but I am completely fresher to Unity , I tried all ways to find solution but no luck.
any suggestion will be appreciated , Thank you,