I have a problem,i created a Level System i level up when i kill an enemy all good,the onyl thing is that i can display my level on my Ui,i searched everywhere but i cant seem to find some solution this is my players level code :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
public class PlayerLevel : MonoBehaviour
{
LevelWindow level;
public Text levelText;
[SerializeField] private LevelWindow levelWindow;
public event EventHandler OnExperienceChanged;
public event EventHandler OnLevelChanged;
public int currentLevel = 1;
public int currentXP = 1;
public int toLevelUp;
void Start()
{
}
void Update()
{
}
public void AddExperience(int experienceToAdd){
currentXP += experienceToAdd;
if(currentXP >= toLevelUp){
currentLevel++;
}
void Awake()
{
PlayerLevel playerLevel = new PlayerLevel();
Debug.Log(playerLevel.GetLevelNumber());
AddExperience(200);
}
}