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.

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.

All individual data list entries are stored as separate assets, only a 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:

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:

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

The handlers are used to manage some part of 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.

About 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.

About 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.

About 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 with custom implementations by simply adding new scripts descending from their base type class, e.g.:

  • Asset sources
    Descend from BaseAssetSource.
  • Input Key IDs
    Descend from BaseInputIDKeySetting.
  • Interpolations
    Descend from BaseInterpolation.
  • Save game files
    Descend from BaseSaveGameFileHandler.
  • Game state changes
    Descend from BaseGameStateChangeType.
  • Game object destructions
    Descend from BaseDestroySetting.
  • Game object spawning
    Descend from BaseInstantiateSetting.
  • Random value generation
    Descend from BaseRandomNumberSetting.
  • Load scene
    Descend from BaseLoadSceneSetting.
  • Schematic actors
    Descend from BaseActorType.
  • Bool values
    Descend from BoolValue_BaseType.
  • Float values
    Descend from FloatValue_BaseType.
  • String values
    Descend from StringValue_BaseType.
  • Vector3 values
    Descend from Vector3Value_BaseType.
  • Value inputs (dialogues)
    Descend from BaseInputOption.

It’s best to look at Makinom’s default implementation for these kind of classes to learn how to do your custom implementation.

Source Code Project #

The full source code included in Makinom Pro is a Visual Studio 2017 project and should be ready 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.