About 'TextMesh Pro & Polish'!


#22

This is my starting page of my game.


#23

Hi, here is my text adventure game screenshot ‘Space Hamster Adventure’ lol


#24

Here is a screenshot of my game ‘Pacific Rim Escape’.

Tried to go with a military-looking heading with some red and blue lettering from the movies.


#25

Here is how I designed my game: Up at Night!


#26

Here is a screen shot from my game:


#27

Hi! I’m actually Having the same problem, but for some reason, I keep getting a NullReferenceException whenever I try to run the game. My code looks like this:

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;

public class AdventureGame : MonoBehaviour {
[SerializeField] public Text textComponent;
[SerializeField] public TextMeshProUGUI stateTitleText;
[SerializeField] State startingState;

State state;

// Use this for initialization
void Start () {

    state = startingState;
    textComponent.text = state.GetStateStory();
    textComponent.fontSize = state.GetStateStoryFontSize();
    stateTitleText = GetComponent<TextMeshProUGUI>();
    stateTitleText.text = state.GetStateTitle(); // gets NullReferenceError

}

The AdventureGame.cs script was also added as components to both the GameObject “Game” and my TextMeshProUGUI Object, named stateTitleText. I manually assign the “State Title Text” object to the “StateTitleText” script variable to each objects’ script components. When I run the program, the Game object sets its “State Title Text” assignment to “None” by itself. The TextMeshProUGUI’s stateTitleText assignment doesn’t share this behavior, though.

I’ve tried to fix this by myself, but I feel that I’m out of my depth. Is there anything I missed, do you think?

Thank you so much for your time and insight!


#28

Hi I don’t really understand why you created stateTitleText. You change the title of the text when you change state?

Also why you declare both variables (attributes) public?
[SerializeField] public Text textComponent;
[SerializeField] public TextMeshProUGUI stateTitleText;

When you put the SerializeField on the variable it means that this variable it is show in the inspector, but when you put the public keyword this variable can be already showed in the inspector.

In summary if you have the keyword public the variables are showed to the other classes and the inspector but when they are private and you put SerializeField the other classes cannot see the variables while the inspector yes.

I know that I didn’t answer your question but I just give a tip about the declaration of the variables.


#29

Hi!
I guess I just default to public when I’m feeling unsure about what I’m doing. I can fix that!

As for stateTitleText, I thought I could have the title header double as a location indicator once you leave the prologue.

Thanks for the insight!


#30

Oh! I just came back from your Discord channel: It turns out that TextMesh objects that are created with the [SerializeField] keyword don’t need to be initialized using the GetComponent() command, too.

Blockquote

stateTitleText = GetComponent(); // <- Ooops!

Thanks again!


#31

Here is my opening screen for the polish challenge. Thanks to everyone else that also posted their great pics!


#32

If you use the attribute SerializeField and pass the component on it you don’t need to do the GetComponent method


#33

Here’s my screenshot!


#34


Hey, this looks like something with a hint of an obscure theme, doesn’t it?

UPDATE:


I guess I improved it? At least I improved it in the sense that it now works for all sorts of 16:9 monitors. “Decision” van’t really be on the same line anymore


#35

Found the Path of Exile font they use for tool tips and such after like 30 mins of searching the internet!


#36

The Unlikely Earthling