Anthony
Thanks for your response, I now have it partially working!
I have added the SelectableByFinger
component to my marker and added my DisplayUI function to the OnSelected
list in the Inspector. I also modified by Marker script to inherit from TouchSelectableBehaviour
and I added:
// when selected
protected override void OnSelected(TouchSelect select)
{
// tell object to display UI
this.gameObject.GetComponent<MapMarker>().DisplayPreview();
}
I also added a listener based on FocusOnClick so that it focuses on the marker. Looks great!
CameraEvents.OnRequestObjectFocus?.Invoke(gameObject, true);
Now it will focus on the marker 80% of the time the first time I select it, and then if I don't move the camera I can still select other markers and have my DisplayUI function execute anywhere between 1 and 3 times before it stops completely. And if I move the camera then I stop being able to select any markers at all (or execute the DisplayUI function).
I also found that the function associated with the touch (DisplayPreview) executed twice, so I added a co-routine delay so that it only executes once.
Could you explain what else I'm missing here and why it's stopping? And please let me know if you need any more information.
Thanks for your time!