HoudiniEngineForUnreal-v2 icon indicating copy to clipboard operation
HoudiniEngineForUnreal-v2 copied to clipboard

[Bug] Exception When Closing Play Before Assets are Fully Loaded

Open blhook opened this issue 4 years ago • 0 comments

I currently have an actor that is attached to the HoudiniPublicAPI in such that when they spawn, they spawn an HDA (see code on bottom for example). When this actor spawns using Play-in-Editor, it will spawn the Actor as expected, as well as the HDA. Generally the play can be stopped fine, too. That said, if the play is stopped before the HDA fully instantiates, this causes an exception in the lambdas of HoudiniEngineDetails.cpp, especially ShouldEnableResetParametersButtonLambda at the code: UHoudiniParameter* NextParm = NextHAC->GetParameterAt(n);. We can circumvent this problem by adding !NextHAC->IsValidLowLevel() to the If performed for the continue (line #229), and then fixing a bad check from a different function to include MainHAC->IsPendingKill() which is missing.

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

#include "HoudiniPublicAPIAssetWrapper.h"
#include "HoudiniPublicAPI.h"
#include "HoudiniPublicAPIBlueprintLib.h"

#include "TestHoudiniActor.generated.h"

UCLASS()
class ATestHoudiniActor : public AActor
{
    GENERATED_BODY()

public:
    UPROPERTY(EditAnywhere, meta =
        (DisplayName = "Houdini Asset"))
    UHoudiniAsset* HDAToLoad;

protected:
    void BeginPlay() override;

private:
    UPROPERTY()
    UHoudiniPublicAPIAssetWrapper* Asset;
};

inline void ATestHoudiniActor::BeginPlay()
{
    Super::BeginPlay();
    UHoudiniPublicAPI* const HoudiniApi = UHoudiniPublicAPIBlueprintLib::GetAPI();
    Asset = HoudiniApi->InstantiateAsset(HDAToLoad, GetActorTransform(), GetWorld(), nullptr, true);
}

blhook avatar Sep 23 '21 22:09 blhook