using UnityEngine;
public class Example : MonoBehaviour
{
Rigidbody rgb;
public float hiz = 20f;
public GameObject prefab;
void Start()
{
rgb = GetComponent<Rigidbody>();
}
void Update() {
if(Input.GetMouseButton(0)){
var screenPos = Input.mousePosition;
GameObject pos = Instantiate(prefab, new Vector2(screenPos.x,screenPos.y), Quaternion.identity);
rgb.AddForce(pos.transform.forward * hiz);
}
}
}