Mesh access in constructor

BugSwat
Tue, 04 Jun 2024 00:14:41 +0000
C++

1. You shall avoid asset references in your c++ code!

2. If the needed mesh is set in a member variable and set in the editor, it is not accessible in the constructor, but in BeginPlay.

3. If the constructor does not add anything like a mesh, you can’t move the object in the editor and you can’t even see it.

4. EVERY example I see, including the Shooter template, add meshes in the constructor.

5. Should I ask questions like this in the “Tutorial” or “Getting started” section? Or is it ok to ask such basic questions here?

I don’t get it. How do I do it correctly?
Of course I want to set the mesh to use in the Blueprint.
Then I can’t use that mesh in the constructor.
Then I can’t see/move the object in the World/Editor.

What am I missing?

Is there a method I don’t know of? I checked AActor and saw methods like “PostActorCreated” but I would be guessing. Is that the one to use?

1 post - 1 participant