Download

[Beginner]C++ To Blueprint

I am making a day and night cycle with a level blueprint, on it I have a timeline and once it is done playing, I would like to have my function executed, here is what I am mentioning.

blue.png


UFUNCTION(BlueprintCallable, Category = "Calendar")
	  void nextDay();	

All nextDay does is to increment my int variable day. How am I supposed to implement this connection?

You are missing a reference to your Calendar object. The level blueprint isn’t a calendar, so you will need to spawn one or get a reference to an existing one. Is your calendar an actor class?

How would I spawn one Calendar object? I have it as a World Setting, later I’d like to change the sky sphere depending on the day. I’m not sure if that would be the best class to inherited but from the description it sounded right.

I can’t say how you spawn a Calendar because you haven’t shown what kind of class it is. :slight_smile: Do you mean it is a subclass of WorldSettings?

Yes, it derives from GameFramework/WorldSettings.h.