- Home /
how to resize plane using touch in gameview
Hi I want to resize plane or cube at runtime using touch or mouse click. I tried some code but that's not working. And I dont have any knowledge about unity that how can we resize the plan. Can you give me some idea about it.
Why not share the things you've tried and ask for help making them work?
see i have following code: var cube : GameObject = GameObject.CreatePrimitive(PrimitiveType.Cube); cube.transform.localScale = new Vector3(4,0.2,2); cube.transform.position = new Vector3(0, 0.1, 0);
this code is for creating dynamically cube. But i didn't find that how can i resize at gameview. The coordination to select that cube that i didn't find please help.
and following code is for resizing window:
var resize_enabled: boolean; var closeButtonStyle:GUIStyle; private var WindowRect = Rect (150,150,250,100); function OnGUI() { WindowRect = GUILayout.Window (3, WindowRect, $$anonymous$$akeWindow, "test");
} function $$anonymous$$akeWindow (id : int) {
// resizing button
resize_enabled = GUI.Toggle(Rect (WindowRect.width - closeButtonStyle.normal.background.width -4,
WindowRect.height - closeButtonStyle.normal.background.height -4,
closeButtonStyle.normal.background.width,
closeButtonStyle.normal.background.height), resize_enabled, "", "close_button");
if (resize_enabled) {
WindowRect.width = Input.mousePosition.x - WindowRect.x + 8;
WindowRect.height = (Input.mousePosition.y * -1) + Screen.height - WindowRect.y + 8;
}
}
I hope you will understand my problem.
Your answer
Follow this Question
Related Questions
How to hit two object with one raycast? 2 Answers
Unity crashes when trying to resize a plane 0 Answers
Help to fix my drag code [SOLVED] 1 Answer
How can I resize a plane? 1 Answer
Windowed game to fullscreen 2 Answers