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 Blueprint_C is not working

Hello,

I have a major problem. A game me and my friend are working on was working for the most part but now we are adding new items to attach to our player (not a 3D game, so can't use sockets). The issue is Casting. We can not cast to a new item like we did before. The UE4 documentation does not solve this problem because UE4 will not let me create a variable with a _C at the end of it. We created this node before but we forgot what we did. I've tried many many things to solve this. Does anyone have any ideas? Thanks.alt text

Product Version: Not Selected
Tags:
castproblem.jpg (379.4 kB)
more ▼

asked Nov 14 '14 at 05:26 AM in Using UE4

avatar image

Comixian
19 5 8 9

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

2 answers: sort voted first

What do you want to cast to where? I only see a general "Cast to Actor" Node. Normaly you need to take a variable or class and pull out the return pin of it. In the menu that pops up you should find the "Cast to bla" Node that matches your Class. If you can't find it, it could be that the Contest Sensitive box at the upper right of the search window is unticked or that the whole thing is broken again.

It's an issue that the Blueprint System can't find some cast nodes. If this is your problem, take a look at this question:

https://answers.unrealengine.com/questions/42595/no-option-to-cast-object.html

it tells you how to fix it.

Here is a picture on how to create the cast node:

You can do this with every other class refence.

In your BP you showed me, you made it with the return value of the For Loop.

asd

more ▼

answered Nov 14 '14 at 08:55 AM

avatar image

eXi
6.8k 333 185 468

avatar image Comixian Nov 14 '14 at 10:21 AM

Basically, I was just trying to recreate the same node I did before because if I can recreate it then it means later when I create a new blueprint, like a torch, I know how to create that node. However, when I try to recreate the Cast To Rake node, UE4 only lets me access SKEL Rake instead of Rake, but the SKEL Rake verison of the Attach event is not compatible with my Cast.

I don't know if I use Cast To Actor to create that cast but it seems like the most logical choice since there is no direct Cast To Rake cast. If I am doing that part wrong, please some one let me know :/

Here's a picture of it:alt textalt text

skel cast.jpg (366.4 kB)
avatar image eXi Nov 14 '14 at 10:30 AM

Nooo :D not like that. You need something that you want to cast. For example, your "GetAllOverlappingActors" gives you an array of these objects. If you go through this array with the for loop, you look at every single actor. Now if you take the "Array Element", you can cast it to a specific class. This will only work, if the Array Element is of that Class. Other casts will fail.

You need something for the object. A cast is just a TypeChange. So if you have something of Type Actor and you this is normaly of type "Rake", you cast it to Rake and you can use all the functions and variables from Rake. Without the cast you can only use the ones of a normal actor base class. Because the compiler things this Variable is of type Actor and not of Rake.

You can cast many things, for example if you have a CustomCharacter, Controller or GameMode. You just get the base class and take the return value. Drag it into an empty space of your Graph and type "Cast". This will show you what are the possibilites to cast.

asd

If you want to recreate it, just take the "Array Element" of the For Each node and type "cast to rake". That should bring you your Cast node :X

avatar image Comixian Nov 14 '14 at 10:50 AM

That also does not seem to work :/

Unless I'm misunderstanding what you mean by Array Element.

(Sorry for all the confusion and Thank you for your patience)

alt text

avatar image eXi Nov 14 '14 at 11:15 AM

Hm yeah, i meant that. Would you mind doing the following:

Go to Editor Preferences > Experimental and enable "Use New Blueprint Menuing System". This could fix it until 4.6 arrives.

avatar image Comixian Nov 14 '14 at 11:30 AM

It works but in reverse for some reason... lol

I had that setting turned on before but I decided to turn it off based on a post you mentioned earlier where someone was toggling this setting to get it to work and now... IT WORKS!!!! :D Thank you for your help!!! It's obvious they really need to fix this...but I guess it'll have to do for now!alt text

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

So you're trying to create another "Cast to Rake"? If so then Click and Drag from the Array Element output of the ForEachLoop node. That should pop open the "Actions taking" menu where you can then select "Cast to Rake" or whatever actor class you need to cast to.

more ▼

answered Nov 14 '14 at 07:47 AM

avatar image

Overkitty
10 2 3 8

(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