I am creating gameobjects at runtime in my MRTK project and use a method to add a NearInteractionTouchableVolume to them (It autoconnects to the BoxCollider already attached to it).
I then add a TouchHandler that I then use to assign one of the 3 touch events before instanciating.
Code:
public static void AddTouchHandler(GameObject target)
{
// Add and configure the touchable
var touchable = target.AddComponent<NearInteractionTouchableVolume>();
touchable.EventsToReceive = TouchableEventType.Touch;
var pointerHandler = target.AddComponent<TouchHandler>();
pointerHandler.OnTouchStarted.AddListener(TestTouchDown);
pointerHandler.OnTouchCompleted.AddListener(TestTouchCompleted);
}
However, in the instanciated Object my TouchHandler looks like this:
It seems that there was no Action added although it should be in my understanding. What irritates me is, that when I assign my TestTouch methods manually to the instanciated object, they get triggered properly. My thoughts are that there must be something wrong with assigning the methods to be executed on events in my code. Did I miss something there?
