Table of Contents

Public properties and fields

Beginner Programmer

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

Property in Game Studio

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


Public properties or fields must be serializable to be used in Game Studio.

Add a public property or field

This script has a public property (DelayTimeOut):

public class SampleSyncScript : StartupScript
	// This public member will appear in Game Studio
	public float DelayTimeOut { get; set; }

Game Studio shows the DelayTimeOut property in the script component properties:

Public property appears in the Property Grid


As a general rule, if you want to display the property or field in Game Studio, getters and setters should do as little as possible. For example, they shouldn't try to call methods or access Stride runtime API.

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

public class SampleSyncScript : StartupScript
   private float delayTimeOut;
   // This public member will appear in Game Studio
   public float DelayTimeOut
   	get { return delayTimeOut; }
   		delayTimeOut = value;
   		Entity.Components.Add(new SkyboxComponent());

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

Hide properties or fields in the Property Grid

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:

	// This public property isn't available in Game Studio
	public float DelayTimeOut { get; set; }

Game Studio no longer shows the property:

Public property been hidden with [DataMemberIgnore]

Adding property descriptions

When you add a <userdoc> comment block above your public property in code, Game Studio will display it in the description field.

	/// This summary won't show in Game Studio
	/// This description will show in Game Studio
	public float DelayTimeOut { get; set; }

Enable documentation file generation:


Game Studio will only look in your build output directory for each assembly. Using the above path is recommended.

On next reload, the Game Studio should display the documentation:

The description now shows in the Property Grid

See also