Can't find System.Collections.Generic.List

Why won’t this work :(?

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

// Tryed this
List myList = new List();
// And this
System.Collections.Generic.List myList = new System.Collections.Generic.List();

// ERROR:
//The type or namespace name `List' does not exist in the namespace `System.Collections.Generic'. Are you missing an assembly reference?

OMG Nice name and profile pic!

using UnityEngine;

using System.Collections;

using System.Collections.Generic;

 

// Tryed this

List<T> myList = new List<T>();

// And this

List<T> myList = new List<T>();

T stands for the type, so like int, string, long, float, short, byte, ect… or a custom type such as a class that your using to keep data or a struct.

That’s not how you define a list; you have to supply the type. See the docs.

–Eric

Haha thanks :slight_smile:

Thank you so much, seems to be working!