I’ll try that and see what happens. I’ve attached a text file to my code, it’s easier than copy and pasting it and it take up endless sections on this page.link text
I’ve added a breakpoint to the code and found that when I get past this line: NewCube->GetStaticMeshComponent()->SetStaticMesh(MyCubeMesh);
it says this in the locals tab in Visual studio next to my NewCube value: ‘variable is optimized away and not available’. I think this may be the problem, but I don’t have a solution to it. I tried changing it volatile as per a website I found, but no luck.
Hey TTaM, I’ve implemented your code and it almost works. Literally a fraction away. I don’t know if you’ve seen it below but the actor appears in the world outliner but there is no mesh so it is invisible, until i assign it one in the editor while the program runs. Any suggestions?
I’d add a break point to your constructor to see if the MyCubeMesh variable is being assigned properly.
Here’s what the locals show after adding a breakpoint to my code. There is something assigned to MyCubeMesh, however with me being new to unreal I’m not sure if it’s anywhere near right. Any chance you can enlighten me on this?
Ok so i put a breakpoint in the code to find out what’s going on. I found that the AStaticMeshActor* variable NewCube has a different assigned value to the MyCubeMesh variable. I’m not sure how but at some point the variable is being changed or isn’t being assigned correctly in the first place. Is there any chance you could test this for me because this is probably the solution?