(Solved) How to use string of Instance Variables?

Hello, I got a problem about Instance Variables.
I did research on GDevelop Instance Variables, and try to use different type of Instance Variables, I still got problem.
If I setup and use an “Number” type of Instance Variables, It can show correct value on the screen. but not for “String” type of Instance Variable.
I make six pictures screenshot. To show the results for when I use “Number” type of Instance Variable and use “String” type of Instance Variables.
screen shot (01-04)
screen shot (05,06)

Please help, thanks.

Variables with text are read with: VariableString(variableName)

Change the text of doornotice set to
doornotice.VariableString(doortitle)

https://wiki.gdevelop.io/gdevelop5/all-features/variables/scene-variables#creating_scene_variables

1 Like

Hi, Thanks for your reply.
The TextObject doornotice’s instants variable is ‘vartitle’.
I try to use : Change the text of doornotice: set to doornotice.VariableString(vartitle)
Also try to use: Change the text of doornotice: set to doornotice.VariableString(doornotice.vartitle)
In runtime, the text still shows: 0

This is the correct way.


Don’t put the string in quotes in the editor properties panel.

Yes, I just understood.
Thanks for your help. :smiling_face:

Sorry for the variable name mix up. Switching between a reply and an image is tough especially when you have very short short-term memory.

This should work, it works for me.

As MrMen said, you don’t need quotes but it shouldn’t make the variable 0, it should only add the quotes to the string like cat to “cat”.

I’ve seen where instance variables get messed up especially if you create them multiple times using different areas. I would try deleting the variables from both the instances and object then add the variables again. Also, make sure you’re using the most recent version of Gdevelop.