Hello. I have tried to copy some code I found on the Unity Docs into my script, but I cannot seem to get it to work. Have been fiddling with it for 30 minutes but still no luck. Lines 16 and 18 are the problem. I have gotten no error messages, but the code no longer works as nothing shows up in the debug menu since I added those two lines. Any help would be appreciated, thanks!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class CharValueStores : MonoBehaviour
{
public static int P1CharNum;
public GameObject Cube;
public GameObject P1Red;
// Update is called once per frame
void Update()
{
Scene scene = SceneManager.GetActiveScene();
if (scene.name == "V3 Select Screen")
{
P1CharNum = Cube.GetComponent<V3SelectScreen>().P1CharNum;
P2CharNum = Cube.GetComponent<V3SelectScreen>().P2CharNum;
}
if (P1CharNum == 1)
{
Debug.Log("P1 == 1");
}
if (P1CharNum == 2)
{
P1Red.SetActive(true);
}
}
}