Any way to start a variable off as NONE?

Forums 💬 NodeCanvas 🗨️ General Discussion Any way to start a variable off as NONE?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #14973
    grofit
    Participant

      So I have a scenario where I want to be able to set 1-3 possible variables on a component. So I was basically going to check if the vars are None, just ignore them. So the vars are a mix of floats (Slider) and int, so by default the vars are all 0, which would mean it would set the vars to 0 and the user has to explicitly set them to NONE.

      So basically its currently an OPT OUT situation and I want an OPT IN, so is there an attribute I can use to default the vars to None?

      #14975
      Gavalakis
      Keymaster

        Hey,

        You can initialize the BBVariable with useBlackboard = true.
        public BBFloat f = new BBFloat{useBlackboard = true};

        As such, it will start with using the blackboard and NONE.

        Although I think it’s a relatively rare occasion, I could create an attribute for that.

        #14974
        grofit
        Participant

          I do not know if others would find it useful, in my specific situation I am trying to get away from having LOTS of individual actions to set an individual property and I want to be able to set multiple properties at once but like I say have it as an opt in situation so they are ignored unless the values are there… for the moment I am happy to just set the attribute.

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