MBS Core


This package contains the scripts and classes I find unmissable in my daily workflow and is thus made available as a separate download to facilitate easier upgrade for past and future projects that make use of them. In time, more code may join the ranks of the core group and will be added to this package if that happens



The MBS Core kit currently contains:

  • CML

    ► CML is a custom data storage and retrieval system. To best describe it, think of it as XML, only easier, faster and better.
    ► CML contains a built in save and load system that utilises PlayerPrefs, Resources folders and file paths.
    ► CML allows you to generate typed variables dynamically at runtime
    ► CML is even smart enough to provide default values when you use a variable that doesn’t exist
    ► This both prevents runtime errors and allows you to save less data to disk
    ► Native support for int, long, float, bool, string, Vector2, Vector3, Quaternion, Color & Rect
    ► Includes a large selection of search, filter and navigation functions

    CML savegame = new CML();
    savegame.Load("SaveGameName"); // (from PlayerPrefs)
    //or savegame.LoadFile(Application.DataPath+"/myfile.txt"); (by path)
    //or savegame.Open("myfile"); (from Resources folder)
    savegame.AddNode("Settings", "volume=0.7; audio=MidnightMoon_3");
    savegame.Last.Seti("age", 18);
    savegame.Last.Set("Male", true);
    savegame.Last.Set("character", "Human13");
    savegame.Last.Set("position", player.transform.position);
    savegame.Last.Set("rotation", player.transform.rotation);
    CMLData inventory = saveGame.Last;
    inventory.Seti("sword", 50);
    inventory.Seti("crossbow", 90);
    inventory.Set("equipped_doublehanded", false);
    inventory.Set("equipped", "sword");
    CMLData player1 = savegame.FirstNodeOfType("player");
    player2.transform.position = player1.Vector3("position");
    player2.transform.rotation = player1.Quaternion("rotation");

  • Encoder

    ► Add MD5 and BASE64 en/decoding to your project
    ► 1 line of code to encode or decode a string

        text = "Hallo world",
        md5 = Encoder.MD5(text),
        encoded = Encoder.Base64Encode(text),
        decoded = Encoder.Base64Decode(encoded);

  • Entities

    ► A replacement system for Unity’s new Hybrid ECS system.
    ► Doesn’t require you to first define a struct of components that define an entity
    ► Simply replace MonoBehaviour with MBSEntity and your entity is defined
    ► Unity requires you to do a FindEntities() call during OnUpdate. MBSEntity does not!
    ►Example use: Create this class and drop it on a number of GameObjects or add it to a prefab

    public MyClass : MBSEntity<MyClass> {}

    Now create this class and drop it anywhere in your scene:

    public class MyClassController: MonoBehaviour{
        void Update() {
            foreach(MyClass entity in MyClass.Entities)
                entity.transform.Translate( new Vector3(0f,0f,1f) * Time.deltaTime);

  • Events

  • ► Contains a custom event based on EventArgs
    ► The event passes both a generic Object and a CML object
    ► The CML object can contain an infinite number of nodes
    ► Each node contains a Dictionary, a List and a generic Object reference
    ► Can easily be the only event you ever need
    ► Creates a way for you to assign many events or Actions to a single variable
    ► This makes for much less coding and no need to remember many event variable names
    ► This automates null checks when triggering events and also simplifies event cleanup
    ► Alternatively, simply use absolutely any GameObject to trigger or respond to events
    ► Identify events using int, string, enum or absolutely anything you want !

    public class Foo : MonoBehaviour {
       void Start()
         CML data = new CML(); 
         //Add whatever data and Objects you want
         this.TriggerEvent(1, new MBSEvent(data) );
    public class Bar : MonoBehaviour {
       void Start()
          this.AddEventListener(1, MyEventResponder);
          this.AddNotificationListener("AllDone", DoSomething);
       void MyEventResponder(object source, MBSEvent data){}
       void DoSomething() {}

  • mbsStateMachine

    ► Super simple to use!
    ► Now also includes mbsStatemachineLeech which allows you to run multiple state machines off of a single state

    public enum EStates { Opening, Open, Closing, Closed } 
    public MBSStateMachine<EStates> state;
    public MBSStateMachineLeech<Estates> leech;
    void Start()
    state = new MBSStateMachine<EStates>();
    leech = new MBSStateMachineLeech<EStates>(state);
    state.AddState(EStates.Opening, DoOpening);
    state.AddState(EStates.Open, DoOpen);
    state.AddState(EStates.Closing, DoClosing);
    state.AddState(EStates.Closed, DoClosed);
    void DoOpening() => Debug.Log(state.CurrentState);
    void DoOpen() => Debug.Log(state.CurrentState);
    void DoClosing() => Debug.Log(state.CurrentState);
    void DoClosed() => Debug.Log(state.CurrentState);
    void Update() {
        if (Input.GetKeydown(KeyCode.Q)) state.SetState(EStates.Opening);
        if (Input.GetKeydown(KeyCode.W)) state.SetState(EStates.Open);
        if (Input.GetKeydown(KeyCode.E)) state.SetState(EStates.Closing);
        if (Input.GetKeydown(KeyCode.R)) state.SetState(EStates.Closed);

  • MBSSingleton

    ► Simply replace MonoBehaviour with MBSSingleton to turn your class into a singleton!

  • mbsSlider

    Inspector configurable system to define areas to place GUI elements into. Slide content into and out of this area complete with fading in and out.

  • PleaseWait

    Display a rotating spinner in the center of the screen. 0 configuration, 1 line of code

  • StatusMessage

    ► Show messages on screen at runtime. 0 configuration, 1 line of code
    ► Shows for 3 seconds then vanishes

    void Start() => StatusMessage.Message = "This object is loaded...";

  • Notifications

    ► Ever needed to show an achievement or something being unlocked? This is for you!
    ► Animated panel slides in and out of the screen
    ► Slide from anywhere to anywhere and then back again
    ► Supports (optional) image along with the message and notification header
    ► Uses Unity UI
    ► Supports notification queuing.

  • Utilities

    ► Includes various utility functions to simplify your development
    ► Unity classes now have a FromString() method to go with it’s ToString() function
    ► Convert Color to hex values for use with Text Mesh Pro
    ► Update a Transform’s position or rotation directly without using temp variables
    ► Update an Image’s alpha value without using temp variables
    ► Strings now have a “bool IsValidEmailFormat()” function
    ► Strings now have a “Texture2D DownloadTextureTask()” function
    ► Strings now have a “Texture2D GetGravatarTask()” function
    ► Convert a Texture2D to a Sprite using Texture2D’s new ToSprite() function

    async void AssignAvatarToImage(Image icon, string email = "guest@mysite.com")
       if (!email.IsValidEmailFormat())
          email = "guest@mysite.com";
       Texture2D tex = await email.GetGravatarTask();
       icon.sprite = tex.ToSprite();


There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.