No announcement yet.

Is Valid function or macro does not take a ref of struct as an input?

  • Filter
  • Time
  • Show
Clear All
new posts

    [BLUEPRINT] Is Valid function or macro does not take a ref of struct as an input?


    It seems that Is Valid function/macro does not take a ref of struct as an input.
    Engine version: 4.15.1

    1.Create a local variable with type of array of struct. (any type.)
    2.Get a reference of element with Get node. (I think it returns a ref after 4.12.)
    3.Try to connect it to Is Valid function or macro node.

    Message "XYZ structure is not compatible with object reference." is shown.

    Related thread:


    I believe this works as intended. Get returns a reference to a UObject and a copy for structs as they are not UObjects. If you drag a wire off a struct array's Get and type valid, you'll observe that ContextSensitive does not allow validation here.

    Could you describe a situation where you'd need to validate a struct?


      As structs containing array menbers are not initialized properly (as default values of arrays in structs are not used) I think the struct is invalid.

      In some type of nodes like Make struct shows errors.
      For example:
      Struct contains 'Vertices ' of type Vector arrays,
      with default value (X=0.000000,Y=0.000000,Z=0.000000) set in struct def.
      No input pin is connected to 'Vertices '.
      Error The current value (((X=0.000000,Y=0.000000,Z=0.000000))) of the ' Vertices ' pin is invalid: Array inputs (like 'Vertices') must have an input wired into them (try connecting a MakeArray node).

      So, Get node should cause similar error (but not).
      Get node returns struct with array size 0, currently.
      I want to check such case.


        I see. Structs are not UObjects..
        I thought that resize does not make elements in some cases. (ex. Structs containing array menbers)


          It's impossible to check if a reference is null, because they can't be null. You can only check if a pointer is valid.

          This extends to all types, not just structs.