how to see if two string are the same (I just what to see if Magicsetom[x] is == to boxadd )

private string MagicNameloder;
[SerializeField] private string boxadd;
void Start()
{
MagicNameloder[0]=“name1”;
MagicNameloder[1]=“name2”;
MagicNameloder[2]=“name3”;
}
void Update()
{
boxadd=“Name”+math.Random.Range(1f, 3f);
for (int x = 0; x < magicsetom.Length; x++)
{
string Test = magicsetom;
if (boxadd !=“”)
{

                        if (x % 2 != 0)
                        {
                            if (Test== boxadd)
                            {
                            Debug.Log("" + Test + "==" + "" + boxadd);
                            Instantiate(Resources.Load("Magic/" + MagicNameloder[x + 1]), 
                           player.transform.position, Quaternion.identity);
                            }
                            else if (Test. != boxadd)
                            {
                                Debug.Log("" + Test + "!=" + "" + boxadd);
                            }
                        }
                  
    
                }
            }
}

This:

boxadd="Name"+math.Random.Range(1f, 3f);

will probably never land on 1f, 2f or 3f as the generated number will be something like 1.04532324f or 0.45382f or 2.4393234f

then even if it will ever land of 2f there is a chance that the resulting string will be “Name1.0f” or similar.

if you want to have three random values 1, 2 and 3 then you need to generate a random int number not a float

Try to debug.log boxadd and see if it actually matches name1 or name2 or name3. Should help you find your issue.

I trying that in the code I do not know what you mean