Add fps and console debugger
This commit is contained in:
50
Assets/Scripts/UI/WristConsole.cs
Normal file
50
Assets/Scripts/UI/WristConsole.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class WristConsole : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI consoleText;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject anchor;
|
||||
|
||||
string output = "";
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
Application.logMessageReceived += logMessageReceived;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
Application.logMessageReceived -= logMessageReceived;
|
||||
}
|
||||
|
||||
private void logMessageReceived(string log, string stack, LogType type)
|
||||
{
|
||||
output = log + "\n" + output;
|
||||
consoleText.text = output;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
Vector3 fakeForward = anchor.transform.forward;
|
||||
fakeForward.y = 0.0f;
|
||||
fakeForward.Normalize();
|
||||
|
||||
transform.position = Vector3.Lerp(
|
||||
transform.position,
|
||||
new Vector3(
|
||||
anchor.transform.position.x,
|
||||
anchor.transform.position.y - 1.0f,
|
||||
anchor.transform.position.z)
|
||||
+ fakeForward * 1.5f,
|
||||
Time.deltaTime * 20.0f);
|
||||
|
||||
transform.rotation = Quaternion.LookRotation(transform.position - anchor.transform.position);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user