Hello!
So, I have a custom class called AOrder and inside that class there’s a function SpawnOrder().
Inside that function I’m trying to call SpawnActor() for some other classes:
/** Templated version of SpawnActor that allows you to specify location and rotation in addition to class type via the template type */
template< class T >
T* SpawnActor( FVector const& Location, FRotator const& Rotation, const FActorSpawnParameters& SpawnParameters = FActorSpawnParameters() )
{
return CastChecked<T>(SpawnActor(T::StaticClass(), &Location, &Rotation, SpawnParameters),ECastCheckedType::NullAllowed);
}
Sorry, I have that in my code, but accidentaly removed it while pasting that into question.
Code is the same as your answer, but still doesn’t work.
Still when i’m trying to run that function in BeginPlay() i get an error, and when i just paste it’s body inside BeginPlay() suddenly starts to work.
I don’t understand xD
Ok, so i think i got the solution:
AOrder was a base class for AOrder_Knight, so when I included Knight into AOrder class, I ran into a circle dependency.
All i had to do was to create special actor (Order_Grid) and then just paste the code.