Getting error when creating instances of static mesh

I created a static mesh from an fbx file I created from Blender.

Now, I want to add instances of the mesh to my scene from blueprint.

First, I created a new blueprint which extends Pawn (Since I want the meshes to receive input).
Then, I dragged the blueprint class to the scene and placed it at 0,0,0.

Now, I went to the blueprint and added an instance:

When I try to run it, I get this error:

Blueprint Runtime Error: "Accessed None trying to read property MeshActor". Node:  Add Instanced Static Mesh Component Graph:  EventGraph Function:  Execute Ubergraph Meshes Blueprint:  Meshes

I am not sure what this means and how to fix it.

Hi NeilAgg,

Just add the “Instanced Static Mesh Component” straight into your blueprint there with the “+ Add” button in the “My Blueprint” tab - then you can just drag that into your blueprint, and “SetStaticMesh” to that.

I am not sure I understand what you are saying.

Are you saying to do this:

Firstly, add the component from here:

image

Then drag that into your blueprint:

image

Then just use it like:

image

The “MeshActor” variable you’re trying to use there in your first example is null which is producing the error - to do it that way, you would need to set that as a valid actor first.

OK, so I removed the Mesh Actor that I had and added the instanced static mesh, I now have this:

I don’t get any errors, but I am not seeing anything on the screen when I hit the play button.

That’s creating a second ISMC (Instanced Static Mesh Component), try this:

Also, doing it this way ends up creating an ISMC for each actor - to get the best performance for ISMs you should try and have a global ISMC. I have a plugin on the marketplace that handles all of that and makes it very easy - rdInst.

Here is what I have now. I think it matches yours:

I am still not getting anything on my screen.

Is it maybe your scale is so small? what if that is set to 10,10,10?

If I manually add the Point mesh at location 0,0,0 with scale 0.1,0.1,0.1, I can see it:

So, a scale of 10,10,10 would be huge. Anyway, I set it. Here is my updated blueprint:

I can see the actor icon in the viewport:

But, when I hit the play button, I don’t see anything:

hmmm, maybe try adding some debugging:

It should work, this is what I get from that:

I added a bunch of print strings to the blueprint:

I get no output from any of them.
I think the Construction Script is not getting called.

This is interesting.

I added a print to the Begin Play event:

And I got the output.

Do you have a CreateMeshes actor in your level? And Screen Messages are enabled?

Maybe try moving that code over BeginPlay to see if it runs ok there?

I have the actor. I sent you a picture of the icon in the viewport.

I am just using the VR Template with starter content, nothing special. Screen Messages has to be enabled since I got the Begin Play message.

When I move the code to BeginPlay, I get these messages on the screen:

Failed to set ISMC Mesh
In Begin Play

When I hit stop, I get a dialog box with this error:

PIE: Error: Blueprint Runtime Error: "Accessed None trying to read property ISMC". Node:  Set Static Mesh Graph:  EventGraph Function:  Execute Ubergraph Create Meshes Blueprint:  CreateMeshes

Great - that gives us an error message :slight_smile:

Yes, you’ve created a “variable” rather than adding a Component:

image

I think the interface for 5.2 of the engine is different than the version you are using. If you look at the My Blueprint area, it is listed under components and the type is Instanced Static Mesh Component:

You can open the “Components” section from the window menu: (It usually shows by default)

That was it! :boom: That was confusing me because there is a section called components in the variables area.

1 Like