Public properties and fields

When you declare a public property or field in a script, the property becomes accessible in Game Studio from the script component properties.

You can attach the same script to multiple entities and set different property values on each entity.

Note

This script has a public property ():

Game Studio shows the property in the script component properties:

Public property appears in the Property Grid

Note

For example, the following code will create problems, as it tries to access , which is only available at runtime:

If you want to include code like this in a property or field, hide it so Game Studio doesn't display it (see below).

If you don't want Game Studio to show a property in the Property Grid, you can:

  • declare your member internal or private, or
  • use the DataMemberIgnore attribute like this: