Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Perform click

Discussion in 'UGUI & TextMesh Pro' started by xtdiwd, Jul 20, 2021.

  1. xtdiwd


    Jul 25, 2020
    Today Jeff flew in space and Unity still has design errors!

    I have a Button that call its function with a parameter if I click on it.
    In the function I had to call EventSystem.current.currentSelectedGameObject.GetComponent<Text>()...
    I need to invoke the function via code myBtn.onClick.Invoke(); but whet it arrive to EventSystem.current it raise an exception because nothing is selected.

    How do I do for perform click on my button?