About 'TextMesh Pro & Polish'!

This is my starting page of my game.

5 Likes

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

4 Likes

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.

5 Likes

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

4 Likes

Here is a screen shot from my game:

16 Likes

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!

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.

1 Like

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!

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!

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

2 Likes

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

Here’s my screenshot!

1 Like


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

3 Likes

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

1 Like

The Unlikely Earthling

1 Like

¯\ __(ツ)_/¯

6 Likes

21%20PM

1 Like

I made a minimalistic kind of theme.

Peace!

1 Like

Blade Runner has always been my preferred movie. Could not resist…
Great Course!

1 Like

Here it is!

4 Likes

Privacy & Terms