How do I reference a BP's variables?

I have a Player (Roller Ball) and I made a BPclass called Cone1 and it has a string variable called “which”.

In my level I placed 2 cone1s into the world. For one of them I made the variable ‘LEFT’ and the other ‘RIGHT’

I want to be able to do this:

RollerBall
Event OnBeginOverlap with Cone1
   if Cone1.which == "LEFT"  --- do something
   else if Cone1.which == "RIGHT" --do something else

This is what I have so far but I can’t figure out how to test the variable from Cone1. Do I have to Cast it?

I saw a reference to “Tags” perhaps I should be looking into that?

I got it working, but let me know if there’s a better way to do it!

You could condense that further.

You shouldnt need to check for the TypeOf Class that the Object is, an CastTo node will return Success or Fail depending on if the Object is that classtype.

nice! thanks!

the reason I had checking the type of class is I was originally going to make different classed objects that the player hits, not all of the same class.

Do you by any chance know how I would do that?

ActorBeginOverlap
    Check is it Cone1?  then do XYZ
           or
    Check is it Cube1? then do ABC
           or
    Check is it Volume Trigger? then do EFG

etc…

You could use Inheritance, create a base class that all your Interactable objects are derived from which holds an Enum with their type. On that Actor you just cast it to the Base class and switch on the Enum like I switched with the string above.

Or you could use an Interface which all your Interactable objects implement and a function in that Interface could return an Enum with its type in it. Then switch over it like above. Using an Interface would avoid casting altogether.

These would avoid having to cast multiple times through different types of object classes.

re:Interfaces…Wow… that’s what I needed! looking into this now! Thanks!