Updating Time Zone with Blueprint - jgoffeney/Cesium4Unreal Wiki

Back

Description

The CesiumSunSky is mainly accessible as a blueprint class and this describes how to update the time zone based on the longitude position of the camera. It relies on using Unreal events and delegates.

Cpp

In the MainActor C++ class define the macro and declare the event.

Macro

Declare a one parameter delegate named FOnTimeZoneUpdate with an integer variable named timeZone.

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnTimeZoneUpdate, int, timeZone);

Event

Declare the event for the delegate FOnTimeZoneUpdate.

UPROPERTY(BlueprintCallable, BlueprintAssignable, Category = "Event Dispatchers")
    FOnTimeZoneUpdate OnTimeZoneChanged;

Broadcast

During the Tick function the time zone is computed from the Longitude value and if is different than the previous value the new value is broadcast out.

OnTimeZoneChanged.Broadcast(timeZone);

Blueprint

This blueprint shows the binding of the delegate function OnTimeZoneChanged and updates the CesiumSunSky instance time zone.

UpdateSunSkyTimeZone