- Home /
why cant I see more than one perameter in gameobjects
This is pretty basic but I'm able to see the equal function in the gameobject inspector but doesn't show with more than one parameter. Any ideas?
public void sub(int a, int b) { int result; result = a - b; print(result); }
public void equal(string st)
{
print(st);
}
Answer by Bunny83 · Feb 12, 2019 at 05:01 AM
I guess you talk about the selection of a method in an exposed UnityEvent callback? Well, Unity only allows a single parameter for their serializable closure construct. The PersistentCall class has a single instance of the ArgumentCache class which can hold a single variable value of various types.
As you can see in the PersistantCall class when it actually creates the delegate, it only supports methods with one parameter. Since the serialization system doesn't support polymorphism for custom serializable classes it would be way to complex to support several different parameters as they all need to be serialized.
Your answer
Follow this Question
Related Questions
Sequence of methods stored in the list with parameters 1 Answer
How to make UI(Gameobject) appear on collision enter? 0 Answers
Display UI under the actual "Gameplay"? 3 Answers
On Button Click Enable - Disable GameObject Through Inspector 1 Answer
Dynamically Added Listener to UI Button Not Calling With Variable Parameters 1 Answer