cast to actor always fails

Look at the compiler results, it tells you “weather ref is already a weather simulator, you dont need Cast To Weather_simulator”, which means the Cast node is useless. You can plug the Get Weather Ref node directly into the one with current time hours, minutes and seconds.

Hi everyone as the title states I am trying to cast to my “weather simulator” which is an actor from the player HUD but it’s always failing and I’m not sure why, usually it works but this time it won’t any help is appreciated thanks in advance :slight_smile:

also here are some screenshots of what I mean

1: the casting

2: the game

as you can see in the game it’s not displaying the time at all

Thank you!!! also any idea how I would make the sun rotate based on the time?

Also I just tried adjusting it from 0 and it didn’t change it stayed 0 any ideas??

Never mind I just put the time in my character blueprint instead

Replace the timespan with your time variable and set the sun actor to be your sun and it should work.

I actually just found this tutorial and am trying it now but if it doesn’t work I will definitely try that thank you!! :slight_smile:

link to tutorial: UE4 Survival Game - Finishing Day/Night Cycle (Part 7) - YouTube

also I’m trying to cast to the weather simulator I made to make this day / night cycle but it’s not working at all when casting from the HUD which is a widget blueprint could you please help???

You can’t cast an undefined (or unset) actor like that. The object you are trying to cast to the weather simulator blueprint is “none”, you must set it before. You could get all actors of class and set it, or simply from your character blueprint, when you are creating the widget, you can set a widget reference variable, then in the widget blueprint itself, cast to the player character, the object you are casting should be get player character and drag a pin out of the as player character and type in your widget variable name. You can do this in the event graph on event begin play, and set the weather ref actor there. I hope this makes sense and will help you. Feel free to ask for further information

Thank you so much !!! it worked !! :slight_smile: :slight_smile: :slight_smile: :slight_smile: thanks for the help

I’m glad it did! For others to find this answer in the future, you can mark it as answer

My pleasure

Ok I have thanks again by the way :slight_smile:

any ideas how I should go about making an options screen like for how long days last and stuff with an enum because I can’t find anything to do with using enums in UMG any help?? sorry for all the questions I’m just trying to finish everything as fast as possible and with good quality :slight_smile: