- Home /
List Type Mismatch
Hello all,
I am trying to create a custom editor tool in Unity, and am running into a bit of a brick wall. One of the classes has:
[SerializeField]
private List<GameObject> objects;
This list just stores a collection of GameObjects so they can all be manipulated at the same time. The problem I'm running into is that whenever I look at the list in the inspector, it say that the contained element is a type mismatch. I don't see why it's doing this because the only object in the list is the default Unity cube.
This is causing me a problem because it's also preventing Unity from properly serializing the list and saving it.
Do anyone know a fix for this?
So, it turns out that this problem is being caused by the fact that scriptable objects cannot store a list of GameObjects.... T_T
@xflagx - I did not. Unfortunately I don't think there is a way around this. Unity has no static method for referencing game objects, which means that they cannot be serialized. I wound up having to save my list of game objects in a monobehavior script attached to an object in the scene.
Your answer
Follow this Question
Related Questions
Serialize game objects in Unity~ 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
missingGameObject problem 3 Answers
GetComponent for gameobject list alternative 1 Answer
A node in a childnode? 1 Answer