C# initializing array of structs error

Hello,

I feel like I’m hitting a wall here. I’m trying to initialize array of structs that contain data for where exactly objects in my level editor should go. Unfortunately it’s not gonna happen because:

error CS1519: Unexpected symbol `}’ in class, struct, or interface member declaration

The code is as follows and according to this SO answer: Initializing an Array of Structs in C# - Stack Overflow it should work (Unity uses C# 4 or so I was told).

public static Category[] categories = new Category[] {
		new Category() {
			name = "Level Objects",
			objects = new CategoryObject[] {
				new CategoryObject() {
					name = "Cube",
					iconName = "cube_ico",
					prefabName = "cube_prefab"
				},
				new CategoryObject() {
					name = "Cylinder",
					iconName = "cylinder_ico",
					prefabName = "cylinder_prefab"
				}
			}
		}
	}

Can someone help me? Obviously CategoryObject and Category are structs.

Do you have a semicolon at the end of it in your script ?

If so, comment everything out then uncomment each part after the other until the error shows up again. That should help you find what you missed !