Im trying to script ui to show the z position of an object in game, im not sure how to this exactly , i tried and edited this script with no success so far, im getting “17,27 cannot inplicitly convert type float to string” error.
I think there is a problem converting text to a number and the component to connect the object whose z will be taken.
I am basicly trying the text to show the z value of object in the scene so any solutions or toughts would be much appreciated.
Regards
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class SomeScriptName : MonoBehaviour
{
public Text scoreText;
void Start()
{
scoreText = GetComponent<Text>();
}
void Update()
{
scoreText.text = transform.position.z;
}
}