how do i make teams for a rts game

I’m making a rts game and ran into this problem of how am i going to set up teams. I can’t use tags or the name of the game object so im not sure how i’m going to do this.

So as you can see I got team 1 and team 2. If I spawned a tank and I am on team 2 I need it to be set to team 2 automaticly. I also need a way to see if my raycast is hitting team 1 or team 2.

I’d suggest using layers personally, you can set a game object’s layer in code:

gameObject.layer = TEAM1;

Then you can use layers to check against the different teams from raycasts:

RaycastHit hit;
Physics.Raycast(origin, Vector3.forward, out hit);

if(hit.collider.gameObject.layer == TEAM2)
{
    //DO STUFF
}

Hope this helps