Trying to create staticmeshcomponent root in c++ for tank

Having an odd issue here. I wanted to add DeathSmoke to my tank, the problem being the tank is created in blueprint, where as our projectile is created in c++. So from C++ I can’t easily access the root of the tank to attach a particle effect like we do with the projectile. My plan was to create a new staticmeshcomponent in the tank constructor and set it as root. Then attach the particle system to that, and in blueprint reattach all the other stuff, tracks, camera, turret, etc.

I copied the code from projectile.cpp and .h to create the component in tank. I changed all the variables and it is created. The problem is, I can’t edit the root component at all. The details panel is just blank. Yet, the root component in the projectile can be edited just fine.

tankcode

Here you can see the code is identical. Ignore those intellisense errors. If you copy code the intellisense never seems to be able to catch up. All the headers that are required are included, and they’re the same between the two. It compiles and runs.

The problem is what I actually see in engine.

UPROPERTY(VisibleAnywhere, Category = "Components")
		UStaticMeshComponent* Tank = nullptr;

There is the info from my header, which matches the projectile.h declaration, and yes i set a forward declaration for it. I can’t figure out why the meshcomponent is showing up blank, with no properties

UPROPERTY(VisibleAnywhere, Category = "Components")
	UStaticMeshComponent* CollisionMesh = nullptr;

Just to compare there is the one from projectile.h

Privacy & Terms