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 get value of an OnClick() Event?

Discussion in 'Scripting' started by juliankraus0, Sep 6, 2020.

  1. juliankraus0

    juliankraus0

    Joined:
    Jan 23, 2020
    Posts:
    2
    Hello,

    I don't know if this is even possible.
    Is there any way to get the value set in the inspector (in this example the 2)?

    Thanks
    upload_2020-9-6_17-16-16.png
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,769
    The argument (int or float) of ModelSelection.SetID() should contain that value when SetID() is invoked.

    Or are you talking about an editor script that digs through the button serialized properties and sees what is in them? That's a heavier lift with editor scripting and serialized properties, but there's plenty of googling to be had.
     
  3. juliankraus0

    juliankraus0

    Joined:
    Jan 23, 2020
    Posts:
    2
    Yes, I want to get the value before SetID gets called.