Make an instance of a predefined class in unity.

Hello,
So, I currently have a script that, as far as what I am trying to do, will create an instance of a script, named DemoAccount.

Here is the script for DemoAccount:
public class DemoAccount : MonoBehaviour
{
public string Username = “”;
public string Password = “”;
public string Title = “Recruit”;
public int PlayerLevel = 0;
public int ExperienceNeeded = 0;
public int ExperienceEarned = 0;
public int SkinUsing = 0;
public bool LevelUnder200 = false;

public void Account(int Scene)
{
    if (Scene == 5)
	{

	}
}

public void LevelingUp()
{
    if (ExperienceEarned >= ExperienceNeeded && PlayerLevel <= 10)
	{
         PlayerLevel = PlayerLevel + 1;
		 ExperienceEarned = ExperienceEarned - ExperienceNeeded;
		 ExperienceNeeded = ExperienceNeeded + PlayerLevel * 10000;
    }
    else if (ExperienceEarned >= ExperienceNeeded && PlayerLevel >= 10 && PlayerLevel <=30)
	{
         PlayerLevel = PlayerLevel + 1;
		 Title = "Warrior";
		 ExperienceEarned = ExperienceEarned - ExperienceNeeded;
		 ExperienceNeeded = ExperienceNeeded + PlayerLevel * 50000;
    }
    else if (ExperienceEarned >= ExperienceNeeded && PlayerLevel >= 30 && PlayerLevel <= 100)
    {
            PlayerLevel = PlayerLevel + 1;
            Title = "Chieftian";
            ExperienceEarned = ExperienceEarned - ExperienceNeeded;
            ExperienceNeeded = ExperienceNeeded + PlayerLevel * 50000;
    }
    else if (ExperienceEarned >= ExperienceNeeded && PlayerLevel >= 100 && PlayerLevel <= 200)

{
PlayerLevel = PlayerLevel + 1;
Title = “Master”;
ExperienceEarned = ExperienceEarned - ExperienceNeeded;
ExperienceNeeded = ExperienceNeeded + PlayerLevel * 100000;
}
else if (ExperienceEarned >= ExperienceNeeded && PlayerLevel >= 200)
{
PlayerLevel = PlayerLevel + 1;
Title = $“Legend{PlayerLevel - 99}” ;
ExperienceEarned = ExperienceEarned - ExperienceNeeded;
ExperienceNeeded = ExperienceNeeded + PlayerLevel * 500000;
}
}

}

}
The error I am getting says that “‘new’ cannot be used with tuple type. Use a tuple literal expression instead.” I am completely unsure as far as what to do here and what this is telling me.

The error is at this:
if (MakePassword.text == ConfirmPassword.text)
{
new (DemoAccount, MonoBehaviour)();
}

I have looked at a lot of things and just haven’t found anything. Can anyone help me figure this out?

Thank you and sorry for the script breaking,

MP

If DemoAccount is a monobehaviour, it needs to be instantiated, not created with new. Are you attaching this to a game object? If not, you should be able to remove the :MonoBehaviour after your class name, and create a new one something like this…

if(MakePassword.text == ConfirmPassword.text)
{
    demoAccount = new DemoAccount();
    //Access this with demoAccount.VariableName
    //If you need to store these, I would create a List<DemoAccount> Accounts = new List<DemoAccount>();
    //then add this to the list with Accounts.Add(demoAccount);
}

Wrote this off the top of my head, so no guarantees, but should get you started.

Hope it helps,
-Larry