Custom SharedVariable is not visible in the Variables list

vizgl

New member
Plugin version:

1751339375310.png

I have created custom SharedVariable:
C#:
[Serializable]
public class AiController
{
    private GameWorld _gameWorld;
    private Player _player;
 
 // ...
}


[Serializable]
public class SharedAiController : SharedVariable<AiController>
{
    public static implicit operator SharedAiController(AiController value) { return new SharedAiController { Value = value }; }
}

And now, when I trying to add variable in the BehaviorTree I can't find it. Is it bug, or I did something wrong?
1751339134443.png

Also, what about runtime variables? Is it possible to create runtime variable which will not be visible in the inspector, but nodes will have access to them?
It would be great to set variables through code without needing to define them in the inspector.

C#:
            _behaviourTree.SetVariableValue("Conditions", _conditions);
            _behaviourTree.SetVariableValue("GameWorld", _gameWorld);
            _behaviourTree.SetVariableValue("Controller", this);
            // etc
Now I need to predefine a lot of variables in the inspector and then write such as code to assign values. I want to skip predifine step
 
Hi, it looks like you are using Behavior Designer Pro, using static implicit operators was how you would do that in the old version, in Pro you need to go to Tools > Opsive > Unit Options > Types to add your custom variable type.

As far as I know we can't have variables created but not displayed in the inspector, but in any case I don't really see the point in that, creating variables in edit mode is no hurdle in BD Pro and it allows you to make use of property binding.
 
Back
Top