O'Reilly logo

Extending Unity with Editor Scripting by Angelo Tadres

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Integrating the Scriptable Object with the level

In this section, we will integrate the LevelSetting class with our levels and then test how Scriptable Objects allow us to modify values in the play mode.

Updating the Level and the LevelInspector class

The first change to be made is to update the Level class. So, instead of using the current variables for the gravity, bgm, and background, start using a LevelSetting class as a reference.

Let's make a small update in Level.cs file. Add the following lines to it:

[SerializeField]
  private LevelSettings _settings;

  public LevelSettings Settings {
    get { return _settings; }
    set { _settings = value; }
  }

We need to take care of the render of this new property.

We will update the DrawLevelDataGUI method in the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required