The-Chinese-Room / Inkpot

Inkpot - a container for Ink
MIT License
174 stars 19 forks source link

Story asset BP accessibility #49

Closed hefty-head closed 12 months ago

hefty-head commented 1 year ago

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 1 year ago

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 :)

TCR-Nick commented 12 months ago

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