What does Public String do in a C script?

Hi,

What does the Public String in a C script do?
For example, there is a Script with Public String Grabbutton = “Grab”.

Could anyone explain to me the purpose of this?

Thanks.

It declares that there is a variable with the name Grabbutton of type string.

Public means that other scripts can read and write to the variable (google access modifiers)

The = bit is simply assigning a default value to the string.

tiny beginner extra
a String is a sequence of characters, essentially a piece of text, and Strings are defined with quotation marks “xxx”

1 Like