How to spawn an actor from a plugin

Bleeck
Tue, 01 Dec 2015 19:35:50 +0000
Plugins

Hi,

I’m working on a plugin and can’t seem to get it to spawn an actor for me. What I’m trying to do is the following :

MySplineClass is a class that has a spline component (made from c++)

I want, when I drag this into the editor, to spawn controller objects on each of the keys of the spline.

I’m currently stuck on spawning the actual controllers.
When I try to use :

    AMyGraphPoint *tempObject = UEditorEngine::AddActor(GetWorld()->GetLevel(0), AMyGraphPoint,ObjTransform);

I keep getting : ‘AMyGraphPoint’: illegal use of this type as an expression.

AMyGraphPoint is :

UCLASS()
class AMyGraphPoint : public AActor
{
	GENERATED_UCLASS_BODY()

public:
	AMyGraphPoint();

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		USceneComponent *OurRoot;

	UFUNCTION(BlueprintCallable)
		void SetGraphPointPosition(FVector pos);
};

I’m not very experienced in c++ so there must be something obvious that I’m missing.

I’ve tried using SpawnActor and I end up at the same road block. There’s something I’m doing wrong in AMyGraphPoint.

Edit: I’m not trying to spawn a blueprint class. Everything is done in c++.

3 posts - 2 participants