Makinom - Game Toolkit for Unity
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • Extensions
    • API
  • Makinom 1
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get Makinom

Guide

Getting Started

  • Introduction
  • First Steps
  • Game Starters
  • Components Overview
  • Upgrading a Makinom 1 Project

Editor

  • Makinom Editor Overview
  • Node Editor
  • Asset Sources
  • Editor Section
  • Base/Control Section
  • Game Section
  • UI Section
  • Templates Section

Features

  • Schematics
  • Dialogue Importer
  • Schematic Nodes
  • Formula Nodes
  • Languages
  • Input Keys
  • Audio and Music
  • Game States
  • Pooling
  • Saving Game Objects
  • Scene Objects
  • Save Games
  • Variables
  • Selected Data

Machines

  • Machine Components Overview
  • Animation Machine
  • Animation State Machine
  • Application Machine
  • Auto Machine
  • Collision Machine
  • Global Machine
  • Interaction Machine
  • Render Machine
  • Tagged Machine
  • Template Machine
  • Tick Machine
  • Trigger Machine

UI System

  • UI System Overview
  • UI Layers
  • UI Layouts
  • UI Boxes
  • HUDs
  • Flying Texts
  • Text Codes
  • Unity UI Module
  • HUDs: Content Providers
  • HUDs: Conditions
  • HUDs: Click Actions

Scripting

  • Scripting Overview
  • Code Extensions
  • Custom Save Data
  • Custom Component Save Data
  • Custom Nodes
  • Starting a Schematic

Advanced Topics

  • Build Troubleshooting
  • Performance Optimizations
  • Home
  • Guide
  • Documentation
  • Scripting
  • Starting a Schematic

Starting a Schematic

Table of Contents
  • Loading from a Schematic Asset
  • Starting a schematic
    • Non-Priority Start
    • Priority Start
  • Starting a schematic in a single line
  • Getting notified by a finished schematic
    • The ISchematicStarter Interface
    • Registering Notify function

Learn how to start a schematic in your code.

You can start a schematic in your custom scripts without having to use a machine component, you just need the schematic asset.

When dealing with schematics, you’ll need to use the schematic namespace:

using GamingIsLove.Makinom.Schematics;

Loading from a Schematic Asset #

Before a schematic can be started, you need to create it using a schematic asset.

You can e.g. add it as a field in your component.

public MakinomSchematicAsset schematicAsset;

Use this code to load the schematic asset into an actual runtime schematic.

Schematic schematic = new Schematic(this.schematicAsset);

Starting a schematic #

You can either start the schematic with or without priority through one of the PlaySchematic functions.

Non-Priority Start #

Let’s take a look at the function to start without priority first:

public virtual void PlaySchematic(object source, ISchematicStarter starter,
	object machineObject, object startingObject,
	bool isBlocking, MachineUpdateType updateType, int inputID)
  • object source
    The source that starts the schematic, e.g. the machine component or global machine starting it.
    Can be ignored in most cases (passing on null).
    This sets the schematic instance’s Source property, which can be used in custom nodes to check what started the schematic (e.g. used in the ORK Framework extension by some nodes to determine if it’s a battle action).
  • ISchematicStarter starter
    The ISchematicStarter interface used as an argument will be notified by the schematic when it finished playing.
    Implement the ISchematicStarter interface in a class (e.g. the class starting the schematic), or just use null as an argument to not get notified.
    You can also get notified by a schematic when it finished by adding a parameterless function to the Notify function of the schematic.
  • object machineObject
    The object that will be used as machine object in the schematic, usually you’ll use a game object.
  • object startingObject
    The object that will be used as starting object in the schematic, usually you’ll use a game object.
  • bool isBlocking
    Use true if this is a blocking schematic, otherwise false.
    Only one blocking schematic can be executed at a time.
  • MachineUpdateType updateType
    The MachineUpdateType enum handles which update function (Update, LateUpdate or FixedUpdate) will be used by the schematic.
  • int inputID
    The input ID that will be used by this schematic.
    You can use Maki.Control.InputID to pass on the current global input ID of Makinom.

A call of this function can look like this.

schematic.PlaySchematic(null, null, machineObject, startObject, false, MachineUpdateType.Update, Maki.Control.InputID);

Priority Start #

Starting a schematic with priority is also done through the PlaySchematic function, using one additional parameter (1st parameter):

public virtual void PlaySchematic(int priority, object source, ISchematicStarter starter,
	object machineObject, object startingObject,
	bool isBlocking, MachineUpdateType updateType, int inputID)
  • int priority
    The priority of the schematic.
    The highest priority number will be executed first.

The rest of the parameters are the same as using the non-priority start function.

A call of this function can look like this.

schematic.PlaySchematic(10, null, null, machineObject, startObject, false, MachineUpdateType.Update, Maki.Control.InputID);

Starting a schematic in a single line #

You can also start a schematic with a single line by using one of the static Schematic.Play functions.

They don’t require to first create an instance of a schematic, but you also don’t have a reference to the started schematic – i.e. it’s more used as a fire-and-forget functionality.

Getting notified by a finished schematic #

There are 2 ways to get notified by a schematic when it finished execution.

The ISchematicStarter Interface #

Implement the ISchematicStarter interface in your class. The interface will add 1 function to the class.

An example implementation in a component can look like this.

public virtual void SchematicFinished(Schematic schematic)
{
	// the schematic finished playing
}

The function will be called with the instance of the schematic that finished execution as a parameter.

Registering Notify function #

Registering a parameterless function using the Notify function of the schematic, e.g. when the function is added to the same class the call is made from:

schematic.Notify(this.SchematicFinished);

The registered function would look like this:

public virtual void SchematicFinished()
{

}

The functions added via Notify will be called before the ISchematicStarter interface. You should add the function via Notify before starting the schematic, in case the schematic finishes immediately (e.g. due to no wait time in nodes being used).

Scripting
Share This Article :
  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
Updated on May 21, 2022
Table of Contents
  • Loading from a Schematic Asset
  • Starting a schematic
    • Non-Priority Start
    • Priority Start
  • Starting a schematic in a single line
  • Getting notified by a finished schematic
    • The ISchematicStarter Interface
    • Registering Notify function
Sitemap
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • Extensions
    • API
  • Makinom 1 Hub
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get Makinom
  • Contact
  • Blog
  • ORK Framework
  • gamingislove.com
Categories
  • Makinom 1 (97)
    • Tutorial (97)
      • 2D Platformer (14)
      • 2D Roguelike (8)
      • Breakout (6)
      • How-to (34)
      • Match 3 (6)
      • Schematic (4)
      • Scripting (6)
      • Space Shooter (11)
      • Survival Shooter (8)
  • News (11)
  • Release (68)
Search

© 2015 Gaming is Love e.U.

Disclosure: This site may contain affiliate links, which means I may receive a commission if you click a link and purchase something that I have recommended. While clicking these links won’t cost you any money, they will help me fund my development projects while recommending great assets!