pos = new Vector3( valueX, valueY, valueZ );
First, you set the `pos ` variable based on your *valueX*, *valueY*, and *valueZ* but they are private (not accessible in the inspector and are changed **after** setting the variable, so *pos* will be (0, 0, 0)
-
valueX = Random.Range( Range1, Range2 );
valueY = Random.Range( Range3, Range4 );
valueZ = Random.Range( Range5, Range6 );
These variables are used on the previous line but set afterwards. The random generated numbers will not be used until the next frame, so this does nothing
-
if ( myPosition == myOldPosition + new Vector3( 10, 0, 0 ) )
Do you want to check if your current position is your old position + 10, or do you want to move 10 if the current position is the old position?
-
for ( int i = 0; i < Random.Range( 1, 5 ); i++ )
{
GenerateIsland();
i = 0;
}
This code block doesn't make sense. You're comparing *i* to a random number every loop so it can skip or repeat *i* but inside the loop you're resetting *i* back to 0. this will make *i* return 0 or 1 and nothing else. What type of behaviour are you trying to achieve?
↧