Topic: Touch marker not run when the markers are close

Hi everyoune!

I have a problem with the click event in my Android App.
The marker clicks run well when they are far. But, when they are very close, It's impossible to execute the event.

it's only appear on the android App. On unity editor the click event run fine.

What can I do? Some idea?

Thanks!!!

Re: Touch marker not run when the markers are close

Hello.

I have never heard of such a problem.
Please send instructions on how to reproduce the problem.
I'll check it out and give you some advice on how to fix it.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

3 (edited by adri2111 2018-10-23 11:32:38)

Re: Touch marker not run when the markers are close

Yes, of course.

My App and the marker components has this look:
PunBB bbcode test

My code to bind event to marker is this:

public OnlineMapsMarker3D AddNewEgg(Egg egg,bool storage=true){
    GameObject prefabEgg =new GameObject();
    prefabEgg= GetEggPrefab(egg);
    OnlineMapsMarker3D marker = new OnlineMapsMarker3D();
 
    marker = onlineMapsTileComponent.AddMarker3D(egg.longitude, egg.latitude, prefabEgg);
    marker.scale = prefabEgg.transform.localScale.x;
    marker.transform.gameObject.GetComponent<EggComponent>().SetEgg(egg);
    if(storage==true){
        if(egg.typeEgg== Egg.TYPE_MANUAL_HW)
            GameSessionController.control.session.mapEggsManualList.Add(egg,marker);
        else
            GameSessionController.control.session.mapEggsRandomList.Add(egg,marker);
    }
    if(egg.opened==0)
        marker.OnClick += eggC;

    return marker;
}

And my situation is:
The click event runs very well with the all eggs on the Unity Editor.
But on Android build, only can click on the single eggs. The eggs that are very close to other can not execute the click event, for example the 3 eggs near to the character.
Can you give me some tips?

Thanks!!

Post's attachments

Attachment icon Capture1.PNG 208.24 kb, 128 downloads since 2018-10-23 

Re: Touch marker not run when the markers are close

Online Maps makes Raycast to markers, and checks if there is an OnlineMapsMarkerInstanceBase Component on the first hit.

Try making Raycast yourself to find out which collider triggered.
Something like:

RaycastHit hit;
if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, OnlineMapsUtils.maxRaycastDistance))
{
    Debug.Log(hit.collider.gameObject.name);
}

Perhaps some other collider overlaps the marker in your case.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Touch marker not run when the markers are close

Thanks for your tip Alex!

I tryed it and I saw that the raycast works fine. But the onclick bind funcion doesn't run.

I'm going to change the bind function to a manual raycast.

What do you think?

Thanks!

Re: Touch marker not run when the markers are close

I think that the manual OnClick invoke should be used at the last moment only if other ways do not help.

I recommend the following testing steps:
1. Make sure you don't have UI elements above the markers.
By default, it blocks map events and markers events.
The easiest way to make sure that the problem is not in UI is to use Online Maps / Troubleshooting / Not Interact Under GUI - OFF.
2. Make sure that RaycastHit (from the previous post) contain the correct GameObject.
3. Make sure that GameObject has OnlineMapsMarkerInstanceBase component.
4. Make sure that OnlineMapsMarkerInstanceBase.marker.OnClick != null.
5. Manually invoke OnClick by wrapping it in try / catch to make sure that it does not cause any exception.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Touch marker not run when the markers are close

Ok Thanks.
Finally, I use the Physics raycast to detect the marker and control the UI interface with the GraphicRaycaster to avoid the double interaction.