using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; public class FireballSpawner : MonoBehaviour { public GameObject dragonHead; public GameObject fireball; void Update() { if (Input.GetMouseButtonDown(0)) { Vector3 mouseClickFromCamera = Camera.main.ScreenToWorldPoint(Input.mousePosition); mouseClickFromCamera.z = 0; GameObject spawnedFireball = Instantiate(fireball, dragonHead.transform.position, Quaternion.identity); spawnedFireball.GetComponent().destination = mouseClickFromCamera; } } }