Ive found the following:
Ive made a script that assigns the objects when a button is pressed. Pausemenuui was grabbed successfully, however:
game = FindAnyObjectByType();
sharedData = FindAnyObjectByType();
did not work and are still null according to player.log. They are on the GameManager:
the gamemanager script:
using UnityEngine;
using System.Collections.Generic;
using Steamworks;
using UnityEngine.SceneManagement;
using Mirror;
using UnityEngine.UI;
public class GameManager : MonoBehaviour
{
public int EggsCollected;
public Vector3 CurrentCheckpointCoordinates;
public List<FrogFRMultiplayerScript> Frogs = new List<FrogFRMultiplayerScript>();
public bool ShowPlayerIcons;
public GameObject soloplayer;
private void Start()
{
SteamAPI.Init();
DontDestroyOnLoad(gameObject);
ShowPlayerIcons = false;
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.I))
{
ShowPlayerIcons = !ShowPlayerIcons;
}
ListPlayers();
//Remove
DebugControls();
}
public void ListPlayers()
{
FrogFRMultiplayerScript[] currentFrogs = GameObject.FindObjectsByType<FrogFRMultiplayerScript>();
foreach (var frog in currentFrogs)
{
if (!Frogs.Contains(frog))
{
Frogs.Add(frog);
}
}
}
public void DebugControls()
{
if (Input.GetKeyDown(KeyCode.K))
{
Debug.Log(Cursor.lockState + " + \n" + Cursor.visible);
}
}
}
And shared data is simply just contains a variable that the soloplayer and the multiplayer player share, once a multiplayer game is started, and the singeplayer is destroyed.
Apparently EVERYTHING fetched with FindAnyObjectByType() in awake() simply does not fetch it.
