onValueChanged.AddListener(method);
void method(float value){}
Why i must use float argument in method if i want to call it with event “onValueChanged”? I not need in those argument but this is requirement for some reason.
onValueChanged.AddListener(method);
void method(float value){}
Why i must use float argument in method if i want to call it with event “onValueChanged”? I not need in those argument but this is requirement for some reason.
OnValueChanged is an event that provides a float as the argument. You are free to ignore the float, but the event is going to provide it anyway.
The reason you have to explicitly accept the float and then reject is because of method overloading. In .NET languages the following are all treated as different methods.
void MyMethod(){}
void MyMethod(float floatArgument){}
void MyMethod(float floatArgument, int intArgument){}
You should use float over other number types, becasue float are used in many fucntions and easier if you want to do complicated stuff with it.