Game Settings

public class GameSettings : ScriptableObject

This class describes the main game settings storage. It is stored as an SO asset, and an example of this file can be found in the Resources/Data folder. Look for the asset named GameSettings. At the same time, the running game uses only one GameSettings file.

If you’re extending your game, you can add your own fields to this script and it will appear in the GameSettings asset file.

To get access to the GameSettings asset used in the current game match, you need to use the GameplayService.GameSettings field (see the example below).

Example

// this example code can be run from any script, but only on correctly set up scene

[Inject] GameplayService gameplay;

<...>

void Start()
{
  var gameSettings = gameplay.GameSettings; // gets the actual game GameSettings asset file

  Debug.Log("Max resource amount allowed: " + gameSettings.MaxResourceAmount); // will print the max amount any single resource can reach, which is set up in the GameSettings asset
}