Prefab always instanciated at 0

I’m making a 2D rpg and I’ve got an issue with damage numbers(numbers that should appear where the weapon hits an enemy and then float up and disappear after a few updates).

Damage number is a canvas prefab with a child text gameobject;
To create the damageNumber I’m using this command:

var clone=(GameObject)Instantiate(damageNumber,hitPoint.position,Quaternion.Euler(;

where damageNumber is the canvas with the damage numbers,and hitPoint is an empty gameobject child of the weapon from which damage numbers should spawn,but instead they keep spawning at x:0 y:0 z:0 and then float up.

Here’s the script that makes the numbers float up(attached to the canvas)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class FloatingNumbers : MonoBehaviour {

	public float moveSpeed;//speed at which the number goes up
	public int damageNumber;//damage number shown
	public Text displayNumber;//refers to the text box child of the canvas
	// Use this for initialization
	void Start () {
	// Update is called once per frame
	void Update () {
		displayNumber.text = "" + damageNumber;//shows damage number in the textbox
		transform.position=new Vector3(transform.position.x,transform.position.y+(moveSpeed*Time.deltaTime), transform.position.z);//makes the number go up.I think that the problem may be here;

Sorry for bad English
I’m not a native speaker

I bet the value of hitPoint.position is wrong. You can test this by commenting out the contents of your Update() function, and you’ll probably see it sitting at 0,0,0 not moving. Part of the reason I think this is true is your transform.position line doesn’t edit the x and z values, so the transform must be set to those values initially.

Try printing hitPoint.position to the debug log when you get hit.