Local variable default values reset in function library

I have a function in a function library that is supposed to return a skeletal mesh. I set up an array as a local variable that contains all the possible return values as its default. When I run the game and debug the function, the array is just filled with None values (ie it has the correct length but each value is None instead of the meshes I set up as the default). I’ve also found that if I create non-array variables they are reset as soon as the function library is compiled.

This happened with all the variable types I tried in the “Object Reference” section of the type dropdown, but not with any of the other categories.

Hello kgamble,

I was unable to reproduce this issue on our end. I tried setting up a function library and I created a local variable (float). I then tried printing this value to the screen and received the default value that I had applied. I have a few questions that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. Can you reproduce this issue in a clean project?
  2. If so, could you provide a detailed list of steps in order to reproduce this issue on our end?
  3. Could you provide a screen shot of any blueprints that may be involved.

This doesn’t happen to float or any other type that isn’t an ObjectReference type (eg material, skeletal mesh, etc). To repro this in a new project:

  1. Create a material
  2. Create a function library
  3. Add a function to the library
  4. Add a local variable to the function in the library
  5. Change the type of the local variable to a material
  6. Select the material you created in step 1 as the variable’s default value
  7. Compile

Some screenshots from before and after I compiled the function:

Hello kgamble,

I was able to reproduce this issue on our end. I have written up a report ( UE-18404) and I have submitted it to the developers for further consideration. I will provide updates with any pertinent information as it becomes available. Thank you for your time and information.

Make it a great day