'Unity Mirror: inbuilt buttons not working on client side of the server

I am very new to unity networking and I am trying to make a game where the user can click multiple buttons in order to spawn pieces to a board. I've hit a lot of roadblocks while doing this and I've managed to figure out a lot of them but I seem to be stuck on this one. the buttons click as they should on the host computer however, on the client's computer nothing happens. the button doesn't even highlight when clicked which is an inbuilt unity feature

I have used this code to spawn in all the button prefabs into the code. the prefabs have a prebuilt network identity and a network transform component i have tried with or without client authority and nothing changes.
public class BoardSetupScript : NetworkBehaviour { public GameObject[] SpawnList;

public bool isPlayer1; //used to determine which set of objects need to be placed. public GameObject self; //makes sure the set up only happens once // Start is called before the first frame update void Start() { if (self.transform.position.x < 0) //the two players are spawned on either ends, to tell which one is which we use the position of object { isPlayer1 = true; } else { isPlayer1 = false; } }

// Update is called once per frame
void Update()
{
    if (isLocalPlayer) //checks that only the player that has authority over this object can execute this function
    {
        if ((Input.GetKeyDown(KeyCode.Space))&(oncespawned==false))
        {
            oncespawned =true;
            SpawnAllObjects();
        }
    }
}
void SpawnAllObjects()
{
    Cmd_SpawnAllObjects();
}
[Command]
void Cmd_SpawnAllObjects() //object is positioned so that this spawns all the buttons in the correct place, depending on which player the box belongs to. used for loops for efficiency
{
    if (isPlayer1 == true)
    {
        for (int Index=0; Index<10; Index++)
        {
            Rpc_SpawnObject(Index,Index);
        }
    }
    if (isPlayer1 == false)
    {
        for (int Index=10; Index<20; Index++)
        {
            Rpc_SpawnObject(Index, Index - 10);
        }
    }
}
[ClientRpc]
void Rpc_SpawnObject(int indexOfObject,int relativePos) //instantiate adds the object to the game and then spawn sets it up as part of the network.
{
    SpawnList[indexOfObject] = (GameObject)Instantiate(SpawnList[indexOfObject], new Vector3(this.transform.position.x,this.transform.position.y - relativePos, 0), Quaternion.identity);
    NetworkIdentity SpawnableIdentity = SpawnList[indexOfObject].GetComponent<NetworkIdentity>();
    NetworkServer.Spawn(SpawnList[indexOfObject]);
    if (connectionToClient != null) //to make sure that Assign Client authority doesnt crash the server
    {
        SpawnableIdentity.AssignClientAuthority(connectionToClient); //gives the player who owns the player object control of this object
        SpawnList[indexOfObject].transform.SetParent(self.transform,true);
    }
}

} here is the code for the functions the buttons are supposed to execute.

public class NetworkBoardStats : NetworkBehaviour { [SyncVar] public bool p1turn=true;

[SyncVar] public int p1gold;

[SyncVar] public int p2gold;

Start() {

}

// Update is called once per frame
void Update()
{
    
}
public void p22EndTurn()
{
    if (isLocalPlayer)
    {
        Rpc_p2EndTurn();
    }
}
public void p1EndTurn()
{
    if (isLocalPlayer)
    {
        Rpc_p1EndTurn();
    }
}
[ClientRpc]
public void Rpc_p1EndTurn()
{
    if (p1turn == true)
    {
        p1turn = false;
        p2gold += 5;
    }
}
[ClientRpc]
public void Rpc_p2EndTurn() //ends player 2's turn over the network.
{
    Debug.Log("p2EndTurn has been activated ");
    if (p1turn == false)
    {
        p1turn = true;
        p1gold += 5;
        Debug.Log("p2EndTurn has been executed");
    }
}

} i have put all the buttons i want to spawn in the spawnable prefabs list my only theory is to why this is could be that i set up the prefabs wrong as i have given the canvas the button is attached to the network identity and transform and not the button itself but you cant have multiple identities on the same object so i dont know how you would do that. any help would be appreciated or if you have a better way of making a bunch of buttons that spawn pieces to fight across a network that would be appreciated too thanks!

apologies for weird formatting stack overflow was being finicky about my code



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source