Linetracing Enum

Hello, I assigned enums to some actors. Now, I want to print the enum type of the object I traced with linetrace to the screen. What missing step do I need to take here? Which node should I add and where should I connect it?

Hey @raphaenn!

So first thing you want to do is make sure these things all share a parent, and put that enum on the parent, compile them all, then make sure each actor has the correct enum value set in class defaults.

Next, off of the line trace, get the hitactor, check it with an “isvalid?” node, and then check “hit actor = BP_PROPPARENT” or whatever you name it with a branch. You don’t need the return value anymore, you can use the branch that’s connected to for this.

IF TRUE, cast the hit actor to BP_PROPPARENT, then as BP_PROPPARENT get “Tests”. Since they all share the parent, and the parent has the enum, you only have to cast the once to get the enum.

Let us know if you run into any snags!

1 Like

am i go right? i dont understand clearly i think. If i false, can u help me? by the way does work but i didnt use Enum.

He said it would be better if all your objects share a base class which has the enum, the way you are currently doing right now will need a cast for every different type of class.

cast to the shared base class and get the enum from it then use a switch case.

2 Likes

Thank u i got it

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.