Instantiating text far right.
Hi I have been following this tutorial series and he is using instantiate, I followed each and every step but my text is appearing far right instead on the tip of the sword which is were the variable hitPoint is. How is this possible? He also used quaternion.euler i don't know if it is one of the factors.
here is my code
using UnityEngine; using System.Collections; using System;
public class HurtEnemy : $$anonymous$$onoBehaviour {
public int damageToGive;
public GameObject damageBurst;
public Transform hitPoint;
public GameObject damageNumber;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.tag == "Enemy")
{
other.gameObject.GetComponent<EnemyHealth$$anonymous$$anager>().HurtEnemy(damageToGive);
Instantiate(damageBurst, hitPoint.position, hitPoint.rotation);
var clone = (GameObject)Instantiate(damageNumber, hitPoint.position, Quaternion.Euler(Vector3.zero));
clone.GetComponent<FloatingNumbers>().damageNumber = damageToGive;
}
}
}
Answer by anjobee · Dec 08, 2016 at 02:46 PM
Bump
Please help me understand quaterion.euler in simple terms
Your answer
![](https://koobas.hobune.stream/wayback/20220612102057im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
problem with setting values of newly instantiated object 2 Answers
respawning enemies that recognize player 1 Answer
How to make unity to continue focusing a the GameObject after it instantiates child element. 1 Answer
Instantiating game objects - shallow or full copy? 0 Answers
How to instantiate a platform each time another platform is 3 units away from the gamecontroller? 0 Answers