Build specific C# Unity

Elapse 3 years ago updated 3 years ago 3

Hello there,

I struggle with building my bolt unit from a c#-script and even the c#-script itself...so prepare for some noob stuff.

I have created succesfully a List which contains items I want to loot. Each item hast some attributes: Name, GameObject, Dropchance and a Amount-value. In code it looks like this:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Ludiq;

public class LootTableScript : MonoBehaviour{
      public class LootTable
         public string Name;
         public GameObject Item;
         public float DropChance;
         public int Amount;
      public List <LootTable> ItemLoot = new List<LootTable>();

Now I want to make it accessable via Bolt to calculate the drops. I thought of the Unit to look like this:

Input: (2)
        -the List where to look for the items. (Bolt needs to be able to read it then) Could be the GameObject              holding it too.
        -an Integer as the Index Value.

Output: (4)
        -show all its attributes or specified in:

I ended up with broken stuff know knowing too little about scripting (thats one of the bolt reasons).

May somebody help me here please? I hope to learn and adapt from this construction example for the future. Is there a way to create this kind of LootTable variable (4 attributes) directly from bolt / in the bolt variable window?

Therefore I just want to add a suggestion: Since we have those SuperUnits which actually look exactly as what I want, isn't there a way to define those as Variable types and add the variable inputs as static references to for example prefabs or give it integers values and so on? Cause its actually what happens, isn't it? This SuperUnit would stay in different, maybe nameable versions (variable inputs) in a List which I access then when I need them.

Thanks for your time, Marten

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):

I don't your answer to the initial question, but if I'm correct, 2.0 will do exactly what your asking for. Super Units will be actually referenced, ports and all, just like code, using the new Class Macro or type. That is super exciting! So it's coming.


Hi Elapse,

If I understand correctly, you want to be able to create a "type" of object with a preset list of variables purely through Bolt, right?

As Jason mentioned, this is one of the core focuses of Bolt 2: classes. In Bolt 1, data (variables) are not strongly connected to logic (graphs), except if you use input/output ports (but these can't be configured from the inspector). This is what we want to improve in Bolt 2.

Thats one part, correctly. I'm already looking forward for version 2 :) When I see your roadmap, there is a lot of stuff which makes me much excited about it, but also it looks like, Bolt 2 will take much more time to ship. So it kinda leaves me waiting for the one day, without a solution for my actual problem than learning C# to compensate. I think I won't come around this process but it might be necessary for the better use of Unity even with Bolt anyway. I might have found the right direction for getting my Unit done soon. So I'm gonna leave me satisfied here. Cheers Marten