5.3.5 currentSelectedGameObject bug. How can I know the object which was clicked?

Simple UI Images with some code like this below are not considering selected anymore (

public class SimpleTest: MonoBehaviour, IPointerDownHandler {

public void OnPointerDown (PointerEventData eventData)
{
if (EventSystem.current.currentSelectedGameObject == null)
{
print(“i am total null”);
}
}

}

This behaviour differs from what it was before but it is logical. Take care.
How I can now learn which object was clicked right now?

Buttons which were created via ui - are selected, my image with Selectable or Button component - is not.

upd: for now i use
public void OnPointerDown (PointerEventData eventData)
{
EventSystem.current.SetSelectedGameObject(gameObject);

It should work

  • not sure how your scene is set up but you need an event system and a raycast (unless you disabled it, it should be there out of the box)
  • replace the code in your pointer down function with Debug.log(gameObject.name);

OnPointerDown works fine

Previously to 5.3.5 the clicked gameObject was put into EventSystem.current.currentSelectedGameObject right after click without my help. So I could knew from any part of code what was clicked right after click. Now it looks like I have to wait for 1 Update.
Try it with eventsystem, raycaycast and simple ui Image not Button.

I misunderstood your question. I do not know about CurrentSelectedGAmeobject.

You could however easily create that reference from the onpointerdown method, I.e. Static class variable.

Don’t have access to computer right now to test event system behavior, I am on 5.3.4, so could check later if it has changed. But possibly its script exec order? Wait 1 update sounds as expected?