x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

cast to actor always fails

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 :)

Product Version: UE 4.19
Tags:
more ▼

asked Jul 21 '18 at 04:53 AM in Blueprint Scripting

avatar image

Chad_kroeger2005
29 1 5 11

avatar image Chad_kroeger2005 Jul 21 '18 at 04:56 AM

also here are some screenshots of what I mean

1: the casting alt text

2: the game alt text

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

screenshot-24.png (262.4 kB)
screenshot-25.png (992.3 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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

more ▼

answered Jul 21 '18 at 10:55 AM

avatar image

DanDC1
41 2 5

avatar image Chad_kroeger2005 Jul 21 '18 at 11:01 AM

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

avatar image DanDC1 Jul 21 '18 at 01:02 PM

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

avatar image Chad_kroeger2005 Jul 21 '18 at 01:03 PM

Ok I have thanks again by the way :)

avatar image DanDC1 Jul 21 '18 at 01:06 PM

My pleasure

avatar image Chad_kroeger2005 Jul 21 '18 at 01:16 PM

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 :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Jul 21 '18 at 05:05 AM

avatar image

Placinta8
183 4 4 10

avatar image Chad_kroeger2005 Jul 21 '18 at 05:10 AM

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

avatar image Chad_kroeger2005 Jul 21 '18 at 05:13 AM

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

avatar image Chad_kroeger2005 Jul 21 '18 at 05:27 AM

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

avatar image Placinta8 Jul 21 '18 at 09:46 AM

alt text

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

avatar image Chad_kroeger2005 Jul 21 '18 at 09:48 AM

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

link to tutorial: https://www.youtube.com/watch?v=z0hOyejl8k0∈dex=7&list=PLtpNaPTkjdL5G4ytDfvakn6VrtATqPJtS

avatar image Chad_kroeger2005 Jul 21 '18 at 10:34 AM

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????

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question