- Home /
Select random object from array
I'm using a script to draw point-cloud from an array of point. The script draws from the first point to the last point in the array (it draw a point every second). Is there a way to draw ALL THE POINT IN THE ARRAY ONCE (important!) in random order? Thanks.
Answer by Chris D · Jul 18, 2011 at 09:51 PM
Without seeing your code, I can't give you many specifics but yes, you can choose random points to draw. Please remember to do a search on the site before asking.
You'll use Random.Range() to produce a random seed and use that as the index for whichever point you want to draw. Then you keep track of what points you've already drawn. This part can be done a number of ways, but here are two from the top of my head:
use a 2D array with a set of
Bool
s (or just two arrays)create a Struct for your point/drawn state and make an array/list of those instead
Your answer
Follow this Question
Related Questions
C# array equal to another array minus one entry. 1 Answer
String Access problem 1 Answer
Spawn object from Random Vector3 in array 0 Answers
Changing Objects Material Using My Array 1 Answer
My loop keeps producing the same wrong result :,,( 2 Answers