(Nice Cayetano) #1

I’m trying to get the variable for my character stats and put it on text(UI). however, I’m trying to use the “TryGetVariableValue” and the text on the variable is still empty. well, what I did is
string Variable Name; VinomaSceneController.Instance.TryGetVariableValue("Variable Name",out stringname);
did I do it right, or there’s more to that?
Also, I’m doing this for a panel to make a menu.

(Leslie Young) #2

Yes, that looks to be correct. Make sure you spelled the variable correctly, it is case sensitive. I’d suggest doing a Console Action (with show variable) in Vinoma just before the call to the script which will be using the variable to see if the variable is set (it will print value to console). I assume you already make a Debug call in your script to inspect what value you received, if any, in the script side?

(Nice Cayetano) #3

It’s not the console that is the problem, I need to know how to print Variable to the Text UI, so that I may customize my panels. however, whenever I use that code, nothing is appearing at the text.In other words, I’m getting variable from Vinoma to print it to a GameObject such as the Text UI. I already knew how to print various text codes using unity, but mixing with Vinoma is a bit of a pickle for me. this is what i really did

 string Lobeliastats;
public Text charatextSTR;
 public void Charastats()

    VinomaSceneController.Instance.TryGetVariableValue("CharaStrength",out charastrength);
    charatextSTR.text = "Character's Strength: " + charastrength;

the CharaStrength is the Variable in Vinoma that has set to 20.
What I want to know how to get that 20 to print it at the Text UI

(Leslie Young) #4

The point with the Console action suggestion is to see whether the variable has a value so you can find where the problem may occur seeing as the code looks to be right (debugging).

You may also want to do a Debug.Log() in your code to see if your Charastats gets called and to see what value charastrength contains, if any.