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)
Get 80% OFF on ALL my Courses and Games!!!
https://cmonkey.co/summerbundle
DONT MISS the latest important trends, sign up for my FREE Weekly Newsletter! https://cmonkey.co/gamedevreport
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!
Get 80% OFF on ALL my Courses and Games!!!
https://cmonkey.co/summerbundle
DONT MISS the latest important trends, sign up for my FREE Weekly Newsletter! https://cmonkey.co/gamedevreport
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 50