Error C2440: 'initializing' : cannot convert from 'USplineComponent *' to 'UObject *'

Hi,

//The following declaration is from header file.
/**Spline component*/
	UPROPERTY(Transient, VisibleAnywhere, BlueprintReadOnly, Category = SplineRoute)
	TSubobjectPtr<class USplineComponent> SplineComp;

//The following code is from C++ file in constructor.
SplineComp = PCIP.CreateDefaultSubobject<USplineComponent>(this, TEXT("Route Spline Path"));

I got compile error C2440.

Any idea? Do I need to include a particular header file?

Cheers,

Hi ,

Yes, to improve compile times, we have been moving more and more classes out of the default includes. You now need to manually include the headers for classes you need.

In this case

#include "SplineComponent.h"

should be enough.

Cheers

Cool, thanks a lot.