Hi guys! I hope you can help me with a simple problem. I’m trying to simulate a “damage score” text on top of the player’s head when it gets hit by an object.
But the problem is I can’t make the position when instantiating it right on top of the player.
This is my code:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
public class Rotator : MonoBehaviour {
public GameObject damage;
//button clicked
public void onDamage(){
GameObject d = (GameObject) Instantiate(damage, transform.position, Quaternion.identity);
}
}
Any advice guys?