FORGOT PASSWORD
Please validate your account by clicking the link in your email
Resend Validation Email
The Summer Sale on the Asset Store is live! Up to 98% OFF!
Complete C# Course from Beginner to Advanced! (with Interactive Exercises!)
Watch my FREE Complete Courses! (Download Project Files and Assets)
The BEST Unity Bundle in ages! Includes my most recommended asset 94% OFF!
https://cmonkey.co/assetstore
Get 98% OFF on awesome REALISTIC HumbleBundle! https://cmonkey.co/humblebundle
C#
Shaders
Editor
Grid System
Marketing
FREE
Battle Royale Tycoon
Quick Tips
Machine Learning
Complete Games

QUESTION OF THE DAY

When would this code cause an error?

Building closest = null;

for (int i = 0; i < instanceList.Count; i++) {

    if (Vector3.Distance(position, instanceList[i].GetPosition()) < Vector3.Distance(position, closest.GetPosition())) {

        closest = instanceList[i];

    }

}

return closest;

When instanceList is empty
When instanceList has at least one element
When instanceList has exactly two elements
My game is RELEASED! I hope you like it!
The BEST Unity Bundle in ages! Includes my most recommended asset 94% OFF!
https://cmonkey.co/assetstore
Get 98% OFF on awesome REALISTIC HumbleBundle! https://cmonkey.co/humblebundle
More Videos

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49