How do I expose a string to the Unity Inspector on a script?

public newString?: String; doesn’t work

Original Post on Discord

by user 103054507105067008

it is public newString? : string (not String)

Does the ‘public’ stop it somehow as it works fine for other variables which confused me

by user 103054507105067008

E.g. public mainUi?: GameObject;

by user 103054507105067008

sorry wasnt clear. See updated reply

String is another type

you need string

by user 103054507105067008

@marcel :cactus: this still catches me out a lot, is there any way to standardise the naming like String would match other things like Vector2 and Material whereas lowercase string looks like it isn’t right

by user 103054507105067008

I get ReferenceError: string is not defined at with

     //@ts-ignore
    @serializeable(string)
     //@ts-ignore
    public text?: string[] = new string [31];

by user 103054507105067008

Ah, seems strings aren’t serializeable

by user 103054507105067008