Hi Im trying to invoke a function which is having 2 parameters, can anyone tell me how to use it say for example im trying to invoke following function void TestTimer (gameObject obj1, gameObject obj2){ .... } so how the invoke is going to be invoke("TestTimerbj1bj2",0.5f);????
Hi Based on the Invoke documentation you cannot include parameters http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.Invoke.html. If you just have two gameObjects and they never will change then just access them in the TestTimer function/method Code (csharp): var gameObject1 : gameObject; // Drag gameobject 1 to this variable in the Unity Editor var gameObject2 : gameObject; // Drag gameobject 2 to this variable in the Unity Editor function Start() { Invoke("TestTimer", 0.5); } function TestTimer() { // perform whatever actions you want on the 2 gameobjects gameObject1.performSomeAction(); gameObject2.performSomeOtherAction(); } If you need to modify 2 gameobjects every 0.5 seconds and the 2 gameobjects can change to be other instances because maybe you have 20 different game objects in your game then that's going to be a little different. Cheers