- Home /
Do you need a realtime data monitor for Unity in your Oculus VR heaset?
Does your Oculus VR development have mysterious problems? Has your development stream come to a screeching halt because of some lack of operation? Have you inadvertently developed yourself in a dark, dark foreboding corner? For you see or don't see the Oculus does not have a runtime debug monitor console(no arguments, please. Just follow along here). Wouldn't it be nice to see data while in the headset running your tests? Or how about listing sql database data ad infinitum? Or dumping the controller and headset to a panel that follows your gaze so you can SEE what is under the cover of darkness? Well have no fear. I have come to the rescue. Yes, I am posting a question and answering it too. Oh downgrade me in the range of multiplicity those self proclaimed prodigies of nothingness. This answer is here and not on stackanything for fear of rejective impulses by the group masochists. Here ya go:
//*************************************************************************
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class MonitorThis : MonoBehaviour
{
private TextMeshPro textMesh;
// Start is called before the first frame update
void Start()
{
textMesh = gameObject.GetComponent<TextMeshPro>();
if(textMesh == null) Debug.Log("No monitor");
//textMesh.text = "";
}
public void MonitorLine(string labelStr)
{
textMesh.text = textMesh.text +
labelStr + "\n";
}
}
//*************************************************************************
// Create Gameobject tagged "CollisionMonitor"
// Create component/Mesh/TextmeshPro Text
//Position where you want in scene
//*************************************************************************
//Then in calling routine add this:
using TMPro;
private MonitorThis m_MonitorThis;
GameObject m_collisionMonitor = GameObject.FindWithTag("CollisionMonitor"); //Gameobject with TexMeshPro
if (m_collisionMonitor != null)
{
m_MonitorThis = m_collisionMonitor.GetComponent<MonitorThis>();
}
//Then calling routine can execute:
m_MonitorThis.MonitorLine("\nCollision Time: " + Time.realtimeSinceStartup.ToString());
//If in Update() you will slow down game but see lots of data. This can be very beneficial.
Enjoy. Oh wait till your see the massive amounts of data streaming in front of your eyes! Gleefully relish the towering edifices of your data accumulating before your very eyes! Your life will never be the same.
Your answer
Follow this Question
Related Questions
Why PlayerPrefs not working although I use "HasKey" and Save() on android? 0 Answers
Saving to a database 1 Answer
Can I download and then read a CSV all at runtime? If so, how? 1 Answer
Linq Query - Strange Outcome 1 Answer
Storing data on a server to be used for player currency in a multiplayer game 1 Answer