Get Class

I created AI, who sees other objects. When I want get class of observed object by “Get Class” it displays class of object with a postscript “_C” (Like: BP_Human_C) in the end. But before it displays without “_C” in the end. That is why I can’t compare this class with desired.

There are historical and technical reasons for this that aren’t particularly important, but ultimately it’s an indicator that the class is a blueprint generated one (“BP_” notwithstanding since that’s not required).

It also shouldn’t matter. You say “I can’t compare this class with desired”, so I get the feeling that you’re trying to get the name of the class and compare it against a known specific name? If that’s the case then the solution is that you shouldn’t be doing that.

Either you should be compare it using the ‘IsA’ check or an ‘Equal’ node with the result of the ‘Get Class’. The ‘IsA’ check is usually better since that will also return true if you introduce a new blueprint that is parented to BP_Human (BP_Boss or something), but ‘Equal’ can be fine if you really only want an exact check.

2 Likes

As @MagForceSeven noted you shouldn’t be comparing class names.

What you want to do is use either Game Play Tags or Actor Tags.

If possible you’ll want to go with the C++ implementation of the IGameplayTagAssetInterface. This allows you to get tags without casting to the actor. Otherwise use Actor Tags which doesn’t require casting.

Check the last paragraph

Yeah tags are another potential solution, depending on the problem. But there’s nothing wrong with using ‘IsA’ or direct equality for something like this.