Instanced Static Mesh doesn't work

Hi everyone, I’m trying to do a small project to better learn the mechanics of Unreal Engine. I am in version 5.3.
I have created a structure with several variables inside including a variable of type Instanced Static Mesh. I have made this structure an array and am trying to change the Instanced Static mesh using a for loop. I scroll through the array and for each element in the array I set the instanced static mesh using the set static mesh construct. I don’t understand if it is me misunderstanding how to use the construct or there is more to it. Every time I try to assign a mesh it gives me an error “Access None trying to read property”. If I understand this error correctly, it indicates that I don’t have a value in the variable, but I don’t quite understand what I should do. I attach screenshot of how I made the blueprint.

I have tried using both ConstructionScript and EventBegin and both give me the same result, which is the error.

Obviously there are 3 errors as there are 3 components in my level

Would anyone be able to give me some pointers?

1 Like

Hi, would you mind sharing more information about the structure and Product Mesh?

You can see the elements in the Break node. I send another screenshot.

The product mesh is a simple cube called produt mesh.

This variable is null and doing what you’re doing should throw an error. Creating a variable that can reference a component is not the same as instantiating a component.

Here is the equivalent of what your Struct contains:

It has no value yet :point_up_2:. And now it does:

We’ve created an actual object, placed it in the memory and asked the variable to keep track of it. The ref is not the object, it’s the address of the object in memory.


In your very case, I believe you’re after this:

Working with Struct arrays can be tricky. There is also, of course, a question of why we’re doing it this way in the first place (and what we’re even doing!). You may have a great reason and no other choice, or there might be a better, more efficient way. Soft references come to mind…

4 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.