- Home /
Question by
VYCanMaj · Jul 25, 2013 at 05:51 AM ·
functionparameterreturn value
return value of a function passed to another function as a parameter
When I tried to use the return value of a function which was passed to another function, the script compiler showed an error message like this :
"BCE0051: Operator '+' cannot be used with a left hand side of type 'Object' and a right hand side of type 'int'."
Here is the code :
function Start ()
{
B(A);
}
function A(aa : int) : int
{
return aa+10;
}
function B(bb : Function)
{
Debug.Log(bb(5)+10);
}
which is super simple.
I think the compiler regard the return value of bb(5) as an object. How can I use the return value adequately?
Comment
Your answer
Follow this Question
Related Questions
How to pass Predicate to a Coroutine? 1 Answer
Not all code paths return a value 1 Answer
Function cannot return int!? 2 Answers
Choosing function with highest return value 2 Answers
Why pass parameters into a function? 2 Answers