About 'Dynamically Constructing UObjects'!

  • Creating a new object.
  • Dynamically attaching components.
  • Why is RegisterComponent() important?
  • Setup meshes and materials.
  • Storing an object pool.

(Unique Video Reference: 19_AE_VR2)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!

I could not see the NewObject UStaticMeshComponent after running the game and selecting my character from the World Outliner and looking at the Details tab. I even tried reloading the character blueprint and restarting the editor and it would never show up. I ended up adding VisibleAnywhere to the UProperty() in the header file for the DynamicMesh pointer and I was able to see it after that. Once I ran the game and checked the Details tab, the new UStaticMeshComponent was listed, but I could not see the new cube that was created. I was walking around looking for it, and happened to see my shadow on the wall and I was in the shape of a cube! I moved my head to the side slightly and sure enough, the new cube had spawned over my head and was traveling around with me!

1 Like

Haha! Well found.

I was also having trouble with this. I was using the stationary guardian boundary of the quest (which is quite small), and I couldn’t visibly see the cube as I was inside of it. I have now purposely made myself off-centre with an artificially large play area.

1 Like

I have problems here with Unreal Engine 5.
The compiler works fine but at runtime, the editor crash with the message: Line: 3542] NewObject with an empty name can’t be used to create default subobjects (inside of UObject derived class constructor) as it produces inconsistent object names. Use ObjectInitializer.CreateDefaultSubobject<> instead.

Does anyone have a working solution for this step in the course what is the code for the for loop in the CPP file and how is the declaration in the header file for that?

Can you add this to a new thread please. I have a number of steps to be tried out.

Privacy & Terms