I am revisiting an old project, and going to try updating it, and what I had working back then, no longer works in the latest Unity (2022)
Basically, it is a VR application, and when you enter a collider area, some text fades in, stays visible, until you leave the area (collider) - rinse/repeat.
Back then, I used textmesh pro and the player rig had a collider/rigid body on, and I used this script:
using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class fadeText : MonoBehaviour {
[SerializeField]
string displayTextForThisCollider;
void OnTriggerEnter (Collider col)
{
if (col.gameObject.name == "Player") {
DOTween.PlayForward (displayTextForThisCollider);
Debug.Log ("entered");
}
}
void OnTriggerExit(Collider other)
{
DOTween.PlayBackwards(displayTextForThisCollider);
}
}
The collider has the above script attached to it.
The text was canvas, with a child of textmesh pro and dotween.
Ive since upgraded the VR rig to use hurricane VR, and Ive attached a child collider to it. (so it interacts with the other colliders to trigger the fade in.
Everything seems to be configured as how I used to have it, except it doesn’t work - when I test the game, the text is not visible (good), when I go into the collider, nothing happens… I’m not even seeing the debug log displayed in the console.
So, is there an easier method to do this these days? Or do you see some issue with the above?, I just need to figure out why its not triggering. (yes, collider is trigger) I have a lot of text in different areas and I don’t want them all displayed at once.
Thanks