playMaker

Author Topic: Mouse Pick Event On Unity 6.2 ?  (Read 27845 times)

stigma

  • Full Member
  • ***
  • Posts: 218
Mouse Pick Event On Unity 6.2 ?
« on: August 26, 2025, 02:31:46 AM »
Hi,
I migrated my Unity 2022.3 project to Unity 6.2.
It works fine except for some Mouse Pick Event actions, which exhibit very strange behavior. Have you noticed this?
Thanks
« Last Edit: September 09, 2025, 04:15:00 AM by stigma »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4141
  • Official Playmaker Support
    • LinkedIn
Re: Mouse Pick Event On Unity 6.2 ?
« Reply #1 on: August 26, 2025, 09:30:32 PM »
Have you tried enabling the legacy input system in settings:

Project Settings > Player > Active Input Handling

Use Both to enable both systems.

stigma

  • Full Member
  • ***
  • Posts: 218
Re: Mouse Pick Event On Unity 6.2 ?
« Reply #2 on: August 28, 2025, 02:58:09 AM »
yes I use both but I fixed the problem by using an event with a script instead of Mouse Pick Event.

Code: [Select]
using UnityEngine;
using HutongGames.PlayMaker;

public class ManualMousePickMulti : MonoBehaviour
{
    public LayerMask layerMask; // couche des objets interactifs
    public Camera cam; // caméra de référence
    public float rayDistance = 2f; // distance maximale du raycast

    // Noms des événements PlayMaker selon l’objet cliqué
    public string eventPorte = "clicPorte";
    public string eventObjet = "clicObjet";

    void Start()
    {
        if (cam == null)
            cam = Camera.main;
    }

    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray ray = cam.ScreenPointToRay(Input.mousePosition);
            RaycastHit[] hits = Physics.RaycastAll(ray, rayDistance, layerMask);

            foreach (var hit in hits)
            {
                if (hit.collider != null)
                {
                    PlayMakerFSM fsm = hit.collider.gameObject.GetComponent<PlayMakerFSM>();
                    if (fsm != null)
                    {
                        if (hit.collider.gameObject.CompareTag("Porte"))
                        {
                            fsm.SendEvent(eventPorte);
                            break; // stop après avoir envoyé l’événement porte
                        }
                        else if (hit.collider.gameObject.CompareTag("Objet"))
                        {
                            fsm.SendEvent(eventObjet);
                            break; // stop après l’objet
                        }
                    }
                }
            }
        }
    }
}
There are two event names because sometimes I have an object behind a closet door.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4141
  • Official Playmaker Support
    • LinkedIn
Re: Mouse Pick Event On Unity 6.2 ?
« Reply #3 on: August 28, 2025, 11:00:36 AM »
Thanks for the update. I'll investigate the Mouse Pick Event in Unity 6.2.

stigma

  • Full Member
  • ***
  • Posts: 218
Re: Mouse Pick Event On Unity 6.2 ?
« Reply #4 on: August 30, 2025, 03:18:11 AM »
MousePick Event :
in other places the click no longer works but if I reload the scene it works again. so it's random.
It also happens that the click area is shifted to the left. You also have to reload the scene so that the click is in the center again.
« Last Edit: August 30, 2025, 03:29:01 AM by stigma »

stigma

  • Full Member
  • ***
  • Posts: 218
Re: Mouse Pick Event On Unity 6.2 ?
« Reply #5 on: September 06, 2025, 09:40:59 AM »
Is there any hope for a fix? If not, can you point me to an alternative action that works for the mouse click?

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4141
  • Official Playmaker Support
    • LinkedIn
Re: Mouse Pick Event On Unity 6.2 ?
« Reply #6 on: September 06, 2025, 05:33:21 PM »
I haven't been able to reproduce the problem yet. It seems to be working as far as I can tell.

Are you able to reproduce it in a new scene?
Can you share a project where it doesn't work?

stigma

  • Full Member
  • ***
  • Posts: 218
Re: Mouse Pick Event On Unity 6.2 ?
« Reply #7 on: September 07, 2025, 11:54:59 AM »
I retested with the old Mouse Pick Event. It works so far. If there's any problems, I'll come back here.
Otherwise, sorry to have bothered you :-)

Edit:
Everything is working fine now. I don't know what happened. It was a large project that had been migrated, and something was interfering with the click functionality.

Sometimes a click doesn't work, but if I exit and then re-enter the scene (build), it works.
« Last Edit: September 09, 2025, 04:15:26 AM by stigma »