List won't take some types.

Hey guys, I’m in the middle of a stump I can’t seem to figure out.

Okay, this line of code WORKS

cList.Add (new Camera ()); cList.Add (new CanvasRenderer ()); cList.Add (new Canvas ()); cList.Add (new CanvasGroup ());

However, CanvasScaler won’t work

cList.Add (new CanvasScaler());

Which gives me these errors.

I have already tried doing public CanvasScaler scaler; and adding scaler to the List. Which doesn’t throw any errors, at least until I try to debug log it. Then it says it doesn’t exist…

What is messing it up is the new CanvasScaler() inside the list
Everything else works but CanvasScaler.

All I’m trying to do is store all the Unity Components into a List so I can later use them.

The list is not the problem. The problem is that CanvasScaler has a protected constructor and therefore you can’t create an instance of it.

Besides: I have serious doubts that what you’re doing makes any sense. But then again, i’m only using Unity for a few weeks…