Search Callback System- App Dev Series 12
Objective: create a search callback system to make method can check the result automatically.
We have called a method to process the function to lookup files in server, and how do we know the searching is finished?
In this article, we will create a callback system to do this part to make our app proceed.
Action, as parameter
As we calling a method to run the process, we can use Action as one of the parameter.
In this Action parameter, create a method name and we can call it with some condition.
Then using this parameter method when the progress of this whole method is about reaching the end.
In here I have created a null check to prevent the onComplete() runs under no parameter.
Pass in the parameter with Lambda
Back to where we called this method, using Lambda Expressions to make onComplere() works.
When GetList is finished running and reached the last line of code, it would callback and run this line: selectPanel.gameObject.SetActive(true).
That is how we got a functional callback system.