Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

Adding gravity and texture to newly added game objects

$
0
0
Hello everyone ! I am at the beginning phase of developing with Unity and I have this code to add a game object (simple cube) at the press of a button. private void OnGUI() { if (GUI.Button(new Rect(50, 50, 25, 25), "+")) { GameObject newCube = GameObject.CreatePrimitive(PrimitiveType.Cube); int randNum = Random.Range(2, 5); newCube.transform.position = new Vector3(randNum, randNum, randNum); } } So my question is how to add gravity or even textures to these newly added cubes ? Thanks in advance and sorry for any mistakes I might have slipped in, if any. Dan.

Viewing all articles
Browse latest Browse all 4709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>