Ok, so i’ve made this class called TextSetup, but it wont show up in the inspector when i try to use it. I don’t have a lot of experience using classes so I might have done something wrong, but it would be super neat if I got this to work. :),ok, so i have made this class called TextSetup and it contains three different string. The problem si that when I try to use SerializeField on it, it wont show up in the inspector. I don’t have a lot of experince using classes so i might have done something wrong, but it would be super neat if i got this to work.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class TextSetup
{
public string text1;
public string text2;
public string text3;
}
public class Text : MonoBehaviour
{
[SerializeField]
TextMeshProUGUI text1;
[SerializeField]
TextMeshProUGUI text2;
[SerializeField]
TextMeshProUGUI text3;
[SerializeField]
TextSetup speach;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
text1.text = speach.text1;
text2.text = speach.text2;
text3.text = speach.text3;
}
}
Casiell
2
You have to add [System.Serializable] attribute to your TextSetup class