using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BlockCreate : MonoBehaviour
{
private Vector3 clickPosition;
public GameObject cube;
// Start is called before the first frame update
void Start()
{
cube.tag = "Ground";
}
// Update is called once per frame
void Update()
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit = new RaycastHit();
if (Input.GetMouseButtonDown(0))
{
Debug.DrawRay(ray.origin, ray.direction * 1000, Color.red, 3, false);
if (Physics.Raycast(ray, out hit))
{
Instantiate(cube, hit.point, Quaternion.identity);
}
}
}
}