How do I find out what was passed in my tuple?

Specifically, using the shooting_range_target_device & HitEvent, how can I tell what the object are in the tuple passed in on the event?

1 Like

target is a shooting_range_target_device & Lock is a lock_device

target.HitEvent.Subscribe(onTargetHit);
...
    onTargetHit(Data : tuple()):void={
            if(Agent := agent[Data(0)]){ <-- This line does not compile.
                Lock.Unlock(Agent)

            }
    }

Error:

Dynamic cast $unknown to agent: argument type $unknown must be a class.

Turns out that an empty tuple() definition mean nothing is passed in it. :confused:

What I needed was the use of a Trigger device linked to the Target’s Hit Event and then I’d have access to the Agent… However, I also hit an issue with the optional / nullable parameter ?agent that was passed in…

I found my answer to that here: How do i convert from type ?agent to agent... im so confused with optionals - #3 by Twin01

1 Like

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