ScriptableObject Variable

NodeCanvas Forums Custom Nodes & Tasks ScriptableObject Variable

This topic contains 5 replies, has 3 voices, and was last updated by  aronze 1 month, 3 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #14132



    In Unite 2017, Unity introduce about data oriented programming. Of course, NodeCanvas already run as similar. Anyway, first let to see this code:

    My idea is a very simple. I want to bind my float variable(ScriptableObject) to Blackboard Variable as primitive float. If it is possible, we can use existing actions like MecanimSetFloat.

    I’m digging BBParameter and ScriptControl actions mechanism but if you’re also interesting about this, I want to hear your advice.





    Hmm. I am not sure I completely understand what you mean 🙂
    Can you please clarify? What do you mean by saying “scriptable object float variable” for example?

    Thank you.



    We created something like this for our project. The whole thing was added a little hacky and there is definitely room for improvements 😉
    I added an excerpt of our git patch file containing the changes made to node canvas. (The patch will most likely not work on your project but I think you’ll get the idea from reading it)

    Example usage:
    [CreateAssetMenu(fileName = “new_FloatReference”, menuName = “VariableRefs/Float”)]
    public class FloatRef : VariableRef<float>

    The scriptable objects can then be selected from nodecanvas when selecting a variable.

    You must be logged in to view attached files.


    Thanks for share your code, @wanderfalke. Yes, my idea is exactly same.

    For example, create New Float asset for character health value. This asset used in game logic, health gauge, health text.  See following image:


    This approach is very powerful. Variable asset easily can be use anywhere even out of scene. If you want more, see this link (Unity Documents).

    Finally, I think about following scenario:

    1. Create FSMOwner, Blackboard to my character object.
    2. Create Blackboard variable and link VariableFloat.
    3. If detect collision, decrease VariableFloat.

    In step 3, I want to use just NodeCanvas.Tasks.Actions.SetFloat. I don’t want to create new actions. BBParameter already have binding feature. So I think it can be.

    You must be logged in to view attached files.


    I was found two way for this without modify NodeCanvas code. First way is implement that CustomConverter in TypeConverter. Second way, implement to IConvertible interface. All cases are work fine. Thank you.



    I’m done this work but I can’t find way without modify NodeCanvas.


    I can’t use CustomConverter, because GetSetConverter. See Patch_VariableRef.cs(zip)

    You must be logged in to view attached files.
Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.