Download

How to use UClass::StaticClass with an array of classes?

Hey, so I’m iterating through a list of classes to get some default values from them, but I can’t quite figure the syntax for using my array with UClass::StaticClass

		for (int i = 0; i < SpawnClasses.Num(); i++)
		{
			UClass* iClass = SpawnClasses[i];
			AWSNPC* iActor = Cast<AWSNPC>(iClass::StaticClass()->GetDefaultObject(true));
			SpawntableTotal += 100 / iActor->DifficultyRating;

			GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::FromInt(SpawntableTotal));
		}

But it’s not accepting iClass as a valid class.
What do I need?

Edit: Figured it out, turns out I don’t need ::StaticClass, I can call the GetDefaults on my class directly.