Issue with nullable float

NodeCanvas Forums Support Issue with nullable float

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10127
    bbdata
    Participant

    Hi,

    currently I’m working on actions for Master Audio, where a nullable float is in the parameters for calling PlaySound.
    When I declare ‘pitch’ as ‘float?’ in my action task, node canvas crashes in a loop, error:

    NullReferenceException: Object reference not set to an instance of an object
    NodeCanvas.EditorUtils.GenericField (System.String name, System.Object value, System.Type t, System.Reflection.MemberInfo member) (at Assets/NodeCanvas/Core/Other/EditorUtils.cs:252)
    NodeCanvas.EditorUtils.ShowAutoEditorGUI (System.Object o) (at Assets/NodeCanvas/Core/Other/EditorUtils.cs:113)
    NodeCanvas.Task.DrawDefaultInspector () (at Assets/NodeCanvas/Core/Tasks/Task.cs:479)
    NodeCanvas.Task.OnTaskInspectorGUI () (at Assets/NodeCanvas/Core/Tasks/Task.cs:474)
    NodeCanvas.Task.ShowInspectorGUI (Boolean showTitlebar) (at Assets/NodeCanvas/Core/Tasks/Task.cs:463)
    NodeCanvas.ActionList.ShowNestedActionsGUI () (at Assets/NodeCanvas/Core/Tasks/ActionList.cs:278)
    NodeCanvas.StateMachines.FSMActionState.OnNodeInspectorGUI () (at Assets/NodeCanvas/Systems/FSM/FSMActionState.cs:78)
    NodeCanvas.Node.ShowNodeInspectorGUI () (at Assets/NodeCanvas/Core/Graph/Node.cs:894)
    NodeCanvas.Graph.ShowInspectorGUI () (at Assets/NodeCanvas/Core/Graph/Graph.cs:1006)
    NodeCanvas.Graph.ShowGraphControls () (at Assets/NodeCanvas/Core/Graph/Graph.cs:855)
    NodeCanvasEditor.GraphEditor.OnGUI () (at Assets/NodeCanvas/Core/Editor/GraphEditor.cs:175)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

    Code:

    Without this float? the action work, so what to do?

    #10128
    Gavalakis
    Keymaster

    Hello,

    Sorry for the late reply. I was on a trip 🙂

    I don’t know why you want to use a nullable float for pitch, but I don’t get an error for using one. Are you using the latest NC version 1.5.8?

    By the way, a nullable float will not show up for inspection as well as it won’t be serialized. To avoid the GUI error if you do use some older version, you could simply make it private or add [HideInInspector] on top of it if you do want to leave it public for some reason.

    Cheers!

    Join us on Discord: https://discord.gg/97q2Rjh

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.