List problem?

I have a list for my characters to know how many enemies there are, but there is a problem. Unity says that List is an unknown identifier. I’m using javascript. Here is the code.

var targetList = new List.<GameObject>(GameObject.FindGameObjectsWithTag(targetString));

It’s just whats necessary.

Thanks in advance!

In pretty much every programming language you’ll encounter, List is not the same thing as list. Case matters. Try writing new List.... instead.

Add

import System.Collections.Generic;

To the top of your script.