Im facing problem in accessing SerializeField inside the method that is implemented from a interface.
public class UIManager : MonoBehaviour, IGameOver
{
[SerializeField]
public GameObject gamePlayPanel;
[SerializeField]
public GameObject gameOverPanel;
[Header("Score-board")]
public Text coinScoreText;
public Text diamondScoreText;
private static int coinScore, diamondScore;
public void EndGame(string reason)
{
Debug.LogError(gamePlayPanel); // returning NULL
Debug.Log("Game Over: UI Manager " + reason);
gamePlayPanel.SetActive(false);
gameOverPanel.SetActive(true);
}
}
And the interface looks like below
public interface IGameOver
{
void EndGame(string reason);
}
Is there any other way of accessing SerializeField inside the EndGame()
method which is overrided from IGameOver
interface