- Home /
Question by
clonetrooper2021 · Aug 05, 2021 at 03:04 AM ·
fonttextmesh
Text Mesh Font not changing on mouse hover
Hi all, I'm trying to change the font of a Text Mesh component when my mouse hovers over it, but it simply won't do so. It's not just a regular GUI object, but a custom external asset. Changing the color works, but font won't for some reason. I do, by the way, have the colliders attached. Any solutions? Thanks in advance. Here's the code I'm using:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ChangeTextOnHover : MonoBehaviour
{
[SerializeField] Font change, original;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void OnMouseOver()
{
GetComponent<TextMesh>().font = change;
}
void OnMouseExit()
{
GetComponent<TextMesh>().font = original;
}
}
Comment
Your answer

Follow this Question
Related Questions
Programatically changing Text Mesh Pro font 1 Answer
How to fix TextMeshPro breaking lines and escaping random characters? 0 Answers
Font Metrics 1 Answer
TextMesh.font = ??? 1 Answer
3D Text font issue 2 Answers