private IEnumerator setUpGame() //doing it this way thinking maybe there are button errors because it's grabbing the player who is deactivated.
    {                               //this wasn't the source of the error, error was having an empty onclick list in the inspector
        //I'm leaving this here as a 'best practice.' There is a slim chance that the camera object doesn't deactivate the correct player and it breaks the whole game
        //this acts as insurance against said event happening
        yield return(new WaitForSeconds(0.5f));

        hoe = GameObject.FindGameObjectWithTag("hoe").GetComponent <interactionController>();
        playercontroller = GameObject.FindGameObjectWithTag("Player").GetComponent <playerController>();
        playerinventory  = GameObject.FindGameObjectWithTag("Player").GetComponent <playerInventory>();
        seedButtons[0].onClick.AddListener(() => playerinventory.plantMethod(0));
        seedButtons[1].onClick.AddListener(() => playerinventory.plantMethod(3));
        seedButtons[2].onClick.AddListener(() => playerinventory.plantMethod(1));
        seedButtons[3].onClick.AddListener(() => playerinventory.plantMethod(4));
        seedButtons[4].onClick.AddListener(() => playerinventory.plantMethod(2));
        seedButtons[5].onClick.AddListener(() => playerinventory.plantMethod(5));
        produceButtons[0].onClick.AddListener(() => playerinventory.sellProduce(0));
        produceButtons[1].onClick.AddListener(() => playerinventory.sellProduce(3));
        produceButtons[2].onClick.AddListener(() => playerinventory.sellProduce(1));
        produceButtons[3].onClick.AddListener(() => playerinventory.sellProduce(4));
        produceButtons[4].onClick.AddListener(() => playerinventory.sellProduce(2));
        produceButtons[5].onClick.AddListener(() => playerinventory.sellProduce(5));
        buySeedsButtons[0].onClick.AddListener(() => playerinventory.buyPlant(0));
        buySeedsButtons[1].onClick.AddListener(() => playerinventory.buyPlant(1));
        buySeedsButtons[2].onClick.AddListener(() => playerinventory.buyPlant(2));
        buySeedsButtons[3].onClick.AddListener(() => playerinventory.buyPlant(3));
        buySeedsButtons[4].onClick.AddListener(() => playerinventory.buyPlant(4));
        buySeedsButtons[5].onClick.AddListener(() => playerinventory.buyPlant(5));
    }
 public saveInformation(followPlayer camera, playerController controller, playerInventory inventory, interactionController interaction) //handing it the two scripts that will contain information
 {
     male     = camera.isMale;
     position = new float[] { controller.gameObject.transform.position.x, controller.gameObject.transform.position.y, controller.gameObject.transform.position.z };
     seeds    = inventory.seedArray;
     produce  = inventory.produceArray;
     money    = inventory.money;
     town     = interaction.inTown;
 }
 // Start is called before the first frame update
 void Start()
 {
     StartCoroutine(setUpGame());
     hoe = GameObject.FindGameObjectWithTag("hoe").GetComponent <interactionController>();
 }
    public static void savePlayer(followPlayer camera, playerController controller, playerInventory inventory, interactionController interaction)
    {
        BinaryFormatter formatter   = new BinaryFormatter();
        string          path        = Application.persistentDataPath + "/player.info";                 //creating path and filename, extension doesn't matter, persistent path is universal across OS
        FileStream      stream      = new FileStream(path, FileMode.Create);                           //creates file at path given
        saveInformation information = new saveInformation(camera, controller, inventory, interaction); //creating the save information

        formatter.Serialize(stream, information);                                                      //turning information into binary
        stream.Close();
    }