- Home /
Question by
sreichen · Jul 12, 2017 at 03:38 AM ·
c#objectsscrollviewobject pool
How to change Game Object in code
How would I go about this problem. Lets say I have 2d objects a square and a circle. I want to code a random number function to choose which object will be put up on screen. So it will choose square or circle. So what do I do in code to make it change between circle and square. For example Lets say i'm making a flappy bird style game and I want the color or style of the pipes to change randomly while still scrolling through the view.
Comment
Answer by fvde · Jul 12, 2017 at 08:32 AM
You could just create both objects and enable and disable them depending on which one your random function chooses.
For randomness:
Random.value