Skip to content

Mods Getting started

Diego Giacomelli edited this page Aug 30, 2016 · 3 revisions

Mods

Getting started

Before start this getting started, please read our introduction to Buildron mods.

Downloads

Download the Buildron for your platform (Linux, Mac or Win) and the ModSdk from our releases page. Unzip Buildron in any folder, for example: C:\Buildron.

Create a C# project

Open your IDE (Visual Studio / Xamarin Studio) and create a new C# class library project called "TestMod".

In the properties/options of the project change the target framework to .NET 3.5 (we need to be compatible with Unity3d).

References

In the project references, add the reference to:

Mod.cs

In the root folder of your project add a class file called Mod with the following code.

using Buildron.Domain.Mods;
using UnityEngine;

namespace TestMod
{
	public class Mod : IMod
	{
		public void Initialize(IModContext context)
		{
			context.BuildStatusChanged += (sender, e) =>
			{
				var cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
				cube.transform.position = new Vector3(Random.Range(-5, 5), 30, Random.Range(-1, 1));
				cube.AddComponent<Rigidbody>();
			};
		}
	}
}

Compile the project.

Test the mod

Create a subfolder called "TestMod" inside Buildron mods folder:

  • Mac: Buildron.App\Mods (the "Mods" should be inside Buildron.app. Choose "Show package contents")
  • Linux and Win: "Mods" folder should be in same folder of Buildron executable.

Then copy your project assembly "TestMod.dll" from your bin\Debug folder to your "TestMod" subfolder inside Buildron mods folder. Ex.: c:\Buildron\Mods\TestMod\TestMod.dll

Start Buildron, click on "Play" button. Now, every time a build status changed your mod will create a falling cube inside Buildron.

Conclusion

This was just a getting started to show how easy and fast you can create a mod to Buildron. If you want to build more sofisticated mods, with Unity3d assets and a faster development flow, please take a look on our tutorial "Creating a mod".