HI i am new to unity and this course
i was wondering who calls OnUseinput message because i cant use it in other project. It makes me want to find out
After a hour of search
i found the function is called in class keyboard The Update function
which links to Terminal.ReceiveFrameInput then calls inputBuffer.ReceiveFrameInput
and when ‘\n’ is entered it calls sendcommand function of the inputbuffer class
where i found the OnCommandSentHandler event which adds NotifyCommandHandlers to it in awake of terminal script
But i have difficulty understanding the NotifyCommandHandlers function
var allGameObjects = FindObjectsOfType<MonoBehaviour>();
foreach (MonoBehaviour mb in allGameObjects)
{
var flags = BindingFlags.NonPublic | BindingFlags.Instance;
var targetMethod = mb.GetType().GetMethod("OnUserInput", flags);
if (targetMethod != null)
{
object[] parameters = new object[1];
parameters[0] = input;
targetMethod.Invoke(mb, parameters);
}
}
I know it is about search every object in the game and get the method called OnUseInput then call it.
But i cant find GetType().GetMethod these thing in unity document under monobehavior class ,so i have no clue how to understand them.
Anyone know how to find the reference of System.Reflection and the usage of gettype() getmethod() thing?