Issues with creating the second struct as Sam suggested

Hi everyone,

I thought I’d take it upon myself to simplify the following parameters into a struct, as Sam suggested we try:
int MinSpawn = 1, int MaxSpawn = 1, float Radius = 500, float MinScale = 1, float MaxScale = 1

I was hoping to create a struct similar to FSpawnPosition:
image

So PlaceActors became:
image

and RandomSpawnPositions became:
image

I also adjusted everything within the function to call SpawnParameter.MinSpawn, etc. etc. as we did with SpawnPosition:

But I keep getting the error:

no suitable constructor exists to convert from “int32” to “FSpawnParameter”

I’ve tried creating the struct without assigning default values, but it didn’t change anything.

I’m not sure what I’m doing wrong, though I’m sure it’s blatantly obvious to someone more familiar with C++. Any help is greatly appreciated!

Thanks,

Darren

Have you solved your issue? If not, there are two issues with the code that I could find. The first is that when creating a struct that is going to be used with UFUNCTIONS, you need to declare it as BlueprintType. You do this by filling out the brackets after the USTRUCT so it looks like USTRUCT(BlueprintType). The second, is that you don’t actually call the RandomSpawnPositions function, because of that, it never occurs and no actors are placed. You need to move SpawnPositions and SpawnPosition to global variables in order for them to work properly and then instead of your SpawnPositions = to RandomSpawnPositions(SpawnParameters), just call RandomSpawnPositions(SpawnParameters). I hope that helps.

Thanks. I think I left it so I could move on with the lessons, but ill take another look at it today.

Privacy & Terms