Hey, i’ve made the following class in c++ and am trying to call the SpawnActors method on it from blueprints. What I did in blueprints, was opened up the level blueprints, and created a new variable and set its type to SpawnVolume. I then dragged that variable into the graph view, and added a “SpawnActors” function call in the graph view setting its target to my new SpawnVolume variable instance. I then wired the begin play event to trigger the SpawnActors function. Everything runs, but I don’t get a breakpoint or log statement from my SpawnActors function.
I’m assuming that I missed a step, and I actually need to instantiate my SpawnVolume somehow. Is that correct? Can I not just drag an instance of it out into my level blueprints and have it spawned that way?
Thanks
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "GameFramework/Actor.h"
#include "SpawnVolume.generated.h"
/**
*
*/
UCLASS()
class ASpawnVolume : public AActor
{
GENERATED_UCLASS_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "Spawning")
void SpawnActors(AActor* actor);
};
//CPP FILE
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#include "SampleProject.h"
#include "SpawnVolume.h"
ASpawnVolume::ASpawnVolume(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
}
void ASpawnVolume::SpawnActors(AActor* actor)
{
UE_LOG(LogGame, Warning, TEXT("SPAWN ACTOR"));
}