Cast To Blueprint_C is not working


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.

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.

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:

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.

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

Here’s a picture of it:

Nooo :smiley: 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.

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

That also does not seem to work :confused:

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

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

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.

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!!! :smiley: Thank you for your help!!! It’s obvious they really need to fix this…but I guess it’ll have to do for now!