using System.Collections; using System.Collections.Generic; using DG.Tweening; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; public class PointAnim : MonoBehaviour { public Sprite point; public GameObject mage; public GameObject canvas; // Start is called before the first frame update // Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0) && EventSystem.current.IsPointerOverGameObject()) { Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); mousePosition.z = 0; GameObject ImaGameObject = Instantiate(mage); ImaGameObject.transform.SetParent(canvas.transform); ImaGameObject.transform.position = mousePosition; ImaGameObject.GetComponent().sprite=point; ImaGameObject.transform.DOScale(new Vector3(0,0,0), 01f); Destroy(ImaGameObject, 1f); } } }