Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to assign object and function in inspector like Button's OnClick()?

Discussion in 'Editor & General Support' started by bboydaisuke, Jul 29, 2015.

  1. bboydaisuke

    bboydaisuke

    Joined:
    Jun 14, 2014
    Posts:
    67
    Hello,

    I want to call some object's some function which can be assigned in inspector in my C# script.
    It's perfect if I can assign object and function just like Button UI's OnClick stuff.

    How can I do that? Any idea will be appreciated.
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    A_Marraff, Graph, rlofeudo and 28 others like this.
  3. bboydaisuke

    bboydaisuke

    Joined:
    Jun 14, 2014
    Posts:
    67
    Wow! That's exactly what I wanted. Thank you very much!
     
    karl_jones likes this.
  4. karthickoxygen

    karthickoxygen

    Joined:
    Dec 7, 2014
    Posts:
    1
    I was searching for this simple thing for far too long. Thank you.
     
    Nodrap, torquemadaaa and karl_jones like this.
  5. JgBGDelta

    JgBGDelta

    Joined:
    May 26, 2018
    Posts:
    3
    That was exactly what i was looking for.
     
  6. bhavesh-tiwari

    bhavesh-tiwari

    Joined:
    Aug 27, 2017
    Posts:
    2
    nice thanks man :)
     
  7. sadeq_ss

    sadeq_ss

    Joined:
    Dec 8, 2018
    Posts:
    1
    thank you
     
  8. unity_1stmanleader

    unity_1stmanleader

    Joined:
    Jul 5, 2021
    Posts:
    3
    This is so useful
     
  9. MadsLab

    MadsLab

    Joined:
    Sep 18, 2021
    Posts:
    1
    Can you please tell me how to launch this type of function in unity script