Read Only float
So i want the Time.time shows on the inspector but i dont want to leave it open because it will generate a LOT of errors while ingame (i want my console clear)
So i put this code:
public float tempo{ get{return Time.time;}} *(tempo means time in portuguese(Im from portugal NOT from brazil btw))
but it doesnt show in inspector cause its acts like a getTime fuction
Is any way to do this???
Answer by CapitalLlama · Aug 31, 2016 at 12:44 PM
To the best of my knowledge, you can't do this. You can run scripts in edit mode with ExecuteInEditMode but you still cannot call the Time.time function outside of a base function such as Start() and Update().
The best alternative I can think of is to either use [ExecuteInEditMode] and on Update or OnGUI (Read docs to see when these are called), use Debug.Log(Time.time);
Answer by Crisstastrophe · Aug 31, 2016 at 12:11 AM
@Imeguras Let me know if this helps.
using UnityEngine;
using System.Collections;
public class TimeScript : MonoBehaviour {
public float tempo;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
tempo = Time.time;
}
}