- Home /
problem in accessing guitexture
I have many gameobjects on the screen and on touch of every gameobject I want to draw a guitexture. which I have done by taking a GUITexture and making it prefab and instantiating it in OnMouseDown of the script of the gameobject on touching of which I want to draw the guitexture.
but the problem is that I want the texture to be drawn exactly on the position of the gameobject which is moving at a low speed,But it is being drawn at the position which I have provided in the pixelInset of the GUITexture which is shown in the inspector panel.
1>>>>>>>>>Instantiate(eggbreak,transform.position,transform.rotation);
2>>>>>>>>>Instantiate(eggbreak,new Vector3(0.0f, 0.0f, 0.0f),transform.rotation); 3>>>>>>>>>guiTexture.pixelInset.x = transform.position.x; 4>>>>>>>>>newInset = new Rect(transform.position.x,transform.position.y,Screen.width / 24,Screen.height / 40); guiTexture.pixelInset = newInset;
I have tried all these but nothing is helping me effectively means its not wirking in the way I want.
Your answer