I need a script that will change my player from one object to another if for example mouse 0 is clicked. For example my character is sphere and when I click mouse 0 it transforms it to cube with latency of 0.5 sec and it reverts it to sphere after 10 sec.
Any help would be appreciated !
Let me assume that if you press a certain key then the controls should be transferred to the other object…means if currently you can move the sphere but can’t move cube but after clicking on it the scenario would be like you can move cube but can’t move sphere…are you trying to do something like this??? then try this link link text
it will show you how to change player during gameplay…
Anyone ?
Please guys I really need help ._.
My modeler messed up few things, that’s why i though this code didn’t work. Anyway, since problem with models is solved, I tried to import that code to my game. I managed to make first mesh disappear, but second mesh won’t show up. This is the code
var objWithMesh = GameObject.Find("objectB");
var mf = objWithMesh.GetComponent(MeshFilter);
var mesh = mf.mesh;
function Start () {
}
function Update () {
if(Input.GetButtonDown("Transformation"))
{GetComponent(MeshFilter).sharedMesh = mesh;}
}
Error on first line (You are not allowed to call this function when declaring a variable).