Checking the color of game objects with specific tag.

Hello !
I need a code for loading the next scene in an if the condition satisfied loading nex scene is not a problem but I can not set my condition. The condition is if color all game objects wit tag “Cube” do something.

if(all game objects with tag "Cube".color == "yellow") {
     DO SOMETHING
}

You can put the cubes in an array and use a for loop to check if the color is yellow like this

private GameObject[] m_Cubes;

    private void Start()
    {
        m_Cubes = GameObject.FindGameObjectsWithTag("Cube");
    }

    void Update()
    {
        int amount = 0;

        for (int i = 0; i < m_Cubes.Length; i++)
        {
            if (m_Cubes*.GetComponent<Renderer>().material.color == Color.yellow)*

{
amount++;
}
}

if (amount >= m_Cubes.Length)
{
//DO SOMETHING
}
}

bool areAllObjectsYellow = GameObject.FindGameObjectsWithTag(“Cube”)
.Select(a => a.GetComponent())
.All(a => a.color == “yellow”);

if (areAllObjectsYellow)
{
    // Do something
}

For this script you will need using System.Linq;

Also you didn’t give a lot of information about where your .color comes from
so I assume you have another script on the cube with that property.
You just have to replace “YOURCOLORSCRIPT” with the script name.