0

Bolt 1 Extension method, class properties

JayCee 1 year ago updated by Reality.Stop() 1 year ago 2

Two questions:

1. I've got this static class with extension methods, but nothing is showing up in Bolt.

using UnityEngine;

namespace Extensions
{
    public static class TransformExtensions
    {
        public static Transform UpdateChildMaterials(this Transform transform, Material material)
        {
            foreach (var renderer in transform.GetComponentsInChildren<renderer>())
            {
                renderer.material = material;
            }

            return transform;
        }
    }
}

The filename is the same name as the class name, and the namespace is correct. But I can't get the UpdateChildMaterials method to show up. I've updated my units, rerun the wizard, etc.

2. I've asked in Discord, but am perplexed at how ... convoluted it is just to call from one graph to another specific graph. From what I understand, Bolt doesn't support the concept of callable functions? I have an object hierarchy, and I want to call a specific event or function, pass in parameters, and even get a response.

In C#, in the parent object I can call GetComponentInChildren<T> and call a function of T, and get return values. Is there really no matching functionality for graphs, like GetGraphInChildren<MyGraph>().DoThatThing() ? 

3. I tried to implement something via extension methods or Super unit, that

  • Accepts the name of a graph as a string as input
  • Gets The FlowMachine component(s) in the children
  • Gets the graph(s) of the flow machine(s)
  • Checks the graph's title property to see if it matches the search graph name.
  • etc (doesn't matter past here)

This doesn't work, because even though I can get the component's FlowGraph, I can't access the title property. It doesn't show up in the unit search. This is a serialized, public read/write property of the flow graph. Is there something special I need to do to access properties or fields of objects in the graph?

I love the look and feel of bolt, and am really hoping that I'm just mistaken or missing something.

Thanks!

JC

Bolt Version:
1.4.1.0
Unity Version:
2019.3.0f1
Platform(s):
Windows 10
Scripting Backend:
Mono
.NET Version (API Compatibility Level):
.NET 4.x

Hello, any thoughts or direction on this?

Did you see my response on 1/9 in discord (regarding 1)?  I was able to get your code to show via the method in Bolt-Extensions chat!