You should use GetComponent<"ScriptName">.StartGrab()
, in which ScriptName
is the name of the script that contains StartGrab()
.
Note that as your method has 3 parameters, when you call it, you should pass them, or else you’re gonna get compiler errors.
For example:
GetComponent<"ScriptName">.StartGrab(objectToGrab, grabbedObject, objectController);
You are now correctly calling the method. Note that objectToGrab
, grabbedObject
and objectController
must be declared in the script you are calling the method, and must be type-equivalent as the parameters of StartGrab()
.
8
solved How To Call Function Which Contains Parameter In Any Other Function Of Other Script?