Scripting Overview

A brief overview on scripting with Makinom.

You can find an overview of all available classes in the API documentation.

When scripting with Makinom, either add the GamingIsLove.Makinom namespace (using) or implement your class in the GamingIsLove.Makinom namespace.

// add Makinom namespace
using GamingIsLove.Makinom;

// or use Makinom namespace
namespace GamingIsLove.Makinom
{
	
}

Please note that some of Makinom’s classes are in separate namespaces, e.g. GamingIsLove.Makinom.Components is used for all component classes of Makinom.

The Maki class #

Most of what you need is accessible through the Maki class. It holds references to all data directly referenced by the project (e.g. input keys) and handlers for an easy and centralized access point.

Accessing settings and data #

All individual data list entries are stored as separate assets, only some of them can be accessed through the Maki class due to being directly referenced by the project asset:

  • Maki.Languages
  • Maki.GameStates
  • Maki.InputKeys
  • Maki.MusicClips
  • Maki.GlobalMachines
  • Maki.UILayers
  • Maki.UILayouts
  • Maki.UIBoxes
  • Maki.HUDs
  • Maki.Plugins

E.g. if you want to get an input key, you can access it like this:

InputKey inputKey = Maki.InputKeys.Get(index);

index is an int value representing the index of the input key in the Makinom editor’s list. You can also access them via their GUID (string):

InputKey inputKey = Maki.InputKeys.Get(guid);

guid is a string value representing the GUID of the data.

Beside data list entries, you can also access the general settings, e.g.:

  • Maki.GameControls
  • Maki.GameSettings

Handlers #

There are multiple handler classes that manage parts of a running game.

Instances of those handlers can be accessed via the Maki class during a running game – some examples:

  • Game Handler: Maki.Game
    The Game Handler manages all in-game related data, e.g. the player, global variables, factions, game time, language, etc.
  • Player Handler: Maki.Game.Player
    The Player Handler holds the reference to the player’s game object and handles spawning the player’s prefab (if used).
    The player’s game object can be accessed directly through Maki.Game.Player.GameObject.
  • Variable Handler: Maki.Game.Variables
    This gives you access to the global variables.
    The Variable Handler class is used for managing variables.
  • Save Games: Maki.SaveGame
    The Save Game Handler manages saving and loading the game.

Data Assets #

Data of things like input keys, music clips or formulas are all stored in individual assets.

They are like any regular Unity asset and can be referenced in your custom scripts and components, e.g. an input key:

public InputKeyAsset inputKey;

You can access the settings of an asset via the Settings property, e.g. checking if an input key asset registered a button input for an inputID.

if(inputKey.Settings.GetButton(inputID))

The inputID in this case is an int value representing the input ID to check for (see the Input ID setting of input keys).

As mentioned above, only some of the data assets are directly referenced by the project asset and accessible via the central Maki class. This is due to initializint the project via a game starter also needs to load all references assets, leading to long load times if everything is directly referenced by the project.

Settings #

All classes containing settings that are accessible and saved in the editor must be descendants of the IBaseData interface. The interface implements 2 functions, GetData and SetData, using a DataObject class to store the information in it, and a 3rd function (EditorAutoSetup) used by some special editor cases.

It’s easiest to descend your class from the BaseData class, which already has a default implementation of the interface and handles saving/loading the data automatically.

Save Games #

Save games work similar to the settings class – instead of the IBaseData interface, you need to implement the ISaveData interface.

You can find an sample implementation in the custom save data documentation.

Custom Nodes #

Adding custom nodes to schematics or formulas doesn’t require implementing them in a plugin or Makinom’s source code – you can just add them in a script file in your Unity project.

You can find more details about custom node implementations in the custom nodes documentation.

Schematic Nodes #

Schematic nodes must descend from BaseSchematicNode or any other schematic node class (e.g. BaseSchematicCheckNode for the default Success/Failed slot implementation).

Formula Nodes #

Formula nodes must descend from BaseFormulaNode or any other formula node class (e.g. BaseFormulaCheckNode for the default Success/Failed slot implementation).

Code Extensions #

You can extend many of Makinom’s type selections and settings with custom implementations by simply adding new scripts descending from a base type class.

Learn more in the code extension documentation.

Source Code Project #

The full source code included in Makinom Pro is a Visual Studio 2017 project and should be ready to use out of the box.

The required references to Unity DLLs and functionality are already set up (the DLLs are included in the project’s bin/References folders). If you want to use different Unity versions than provided, just replace the references with the libraries you want to use.