The-Chinese-Room/Inkpot

Story asset BP accessibility

Closed this issue · 2 comments

Not an issue so much as a question, but is there a reason to not make the InkStoryAsset BP accessible? It seems like i should be able to pass a different story asset to an instance of say some actor and have that actor control the story flow.

Alternatively I might just be misunderstanding how unreal handles assets...

Gwk68 commented

Hi, I was trying to figure this out as well, and I believe that you cannot (by default) create variables derived from UDataAsset in blueprints, so what I did was created a new c++ actor and gave it a new UInkStoryAsset as a variable.

Here is what my header file looked like

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "StoryHolderActor.generated.h"

UCLASS() 
class ANAMNESIS_API AStoryHolderActor : public AActor
{
	GENERATED_BODY()

public:
	// Sets default values for this actor's properties
	AStoryHolderActor();

public:
	UPROPERTY(BlueprintReadOnly, EditAnywhere)
	class UInkpotStoryAsset *HeldStory;

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:
	// Called every frame
	virtual void Tick(float DeltaTime) override;
};

From there you can extend a new BP class from this c++ class and you should be able to see the variable in the new BP class.
 
I hope that helps :)

An oversight, should have been a BlueprintType.
This is now fixed.