Hey,
so I just created a basic C++ class for my day/night cycle. Basically the C++ class is the sun which is being rotated. Now I want to add the Directional Light from my custom class (which I created a blueprint from) to my BP_Sky_Sphere so that the rotating sun of my custom class can determine the SkySpheres sky color. However, in the dropdown menu of the BP_Sky_Sphere (where you can pick you light either with the little eardropper or in the dropdown list) the light of my class doesn’t show up.
Anyone knows how to fix this?
Here’s what my class looks like (nothing fancy I skipped the parts which are not neccesary for this example):
Sun.h
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Components/DirectionalLightComponent.h"
#include "Test.generated.h"
UCLASS()
class SURVIVALGAME_API ATest : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ATest();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
UPROPERTY(EditAnywhere, Category = "Light")
UDirectionalLightComponent* Sun;
};
Sun.cpp
#include "Sun.h"
// Sets default values
ATest::ATest()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
Sun = CreateDefaultSubobject<UDirectionalLightComponent>(TEXT("Light"));
Sun->SetupAttachment(GetRootComponent());
}
// Called when the game starts or when spawned
void ATest::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ATest::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
So basically I need to know how to make this light from a custom C++ class which I created a blueprint from to another blueprints dropdown…
Thanks in advance!