SkySphereBP

i took a reference to the skysphere in my c++ but i cant figure out how to get access to the update function to refresh material. My sun rotates in this but the skysphere stays the same until i figure this out.



#pragma once

#include "Runtime/Engine/Classes/Components/DirectionalLightComponent.h"
#include "Runtime/Engine/Classes/Components/SceneComponent.h"
#include "GameFramework/Actor.h"
#include "DayNightController.generated.h"

UCLASS()
class ODDARON_API ADayNightController : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	ADayNightController();

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		float DaySpeed = 1;
	float SunAngle = 0;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		AActor* SunSource;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		AActor* SkyBoxRef;
};


im assuming this cant be done?

The refresh material function isn’t there because your variable is an Actor, and Actor could be any actor. You’ll need to cast it into the Skysphere, but i’m fairly sure that isn’t possible as the Skysphere is implemented in Blueprints, not C++. You might want to try using blueprints instead.

I’d be interested to know if there is a way to do this in code :slight_smile: