Intro to 3D Game Development

0 of 193 lessons complete (0%)

Scripting Part 3: Finishing the Game Loop

Testing: Count DigSpots by Tag

You don’t have access to this lesson

Please register or sign in to access the course content.

To make sure that we are finding all the new dig spots with getEntitiesByTag, we’ll ask the console to log how many entities are in the array, using the length property of the array. 

  1. In the console.log in your randomizeTreasure function, change digSpots[0].name to digSpots.length
  2. Save and press Stop and Play to run the code.
  3. Look in the Dev Tools console to see a number that matches how many dig spots you have.
  4. Try adding and deleting a digSpot and repeating these steps to make sure the number changes.