Public fields not showing in inspector

Public variables at line 8-9 are not showing in inspector. I was following the Unity ‘Tanks!’ tutorial and it said to drag/drop the slider and image into the fields, but I cannot find a way to show them in the inspector.Here is my code:

using UnityEngine;
using UnityEngine.UIElements;

public class TankHealth : MonoBehaviour
    public float m_StartingHealth = 100f;
    public Slider m_Slider;
    public Image m_FillImage;
    public Color m_FullHealthColor =;
    public Color m_ZeroHealthColor =;
    public GameObject m_ExplosionPrefab;

    private AudioSource m_ExplosionAudio;
    private ParticleSystem m_ExplosionParticles;
    private float m_CurrentHealth;
    private bool m_Dead;

    private void Awake()
        m_ExplosionParticles = Instantiate(m_ExplosionPrefab).GetComponent<ParticleSystem>();
        m_ExplosionAudio = m_ExplosionParticles.GetComponent<AudioSource>();


    private void OnEnable()
        m_CurrentHealth = m_StartingHealth;
        m_Dead = false;


    public void TakeDamage(float amount)
        // Adjust the tank's current health, update the UI based on the new health and check whether or not the tank is dead.
        m_CurrentHealth -= amount;

        if (m_CurrentHealth <= 0f && !m_Dead)

    private void SetHealthUI()
        // Adjust the value and colour of the slider.
        m_Slider.value = m_CurrentHealth;
        m_FillImage.tintColor = Color.Lerp(m_ZeroHealthColor, m_FullHealthColor, m_CurrentHealth / m_StartingHealth);

    private void OnDeath()
        // Play the effects for the death of the tank and deactivate it.
        m_Dead = true;

        m_ExplosionParticles.transform.position = transform.position;



I am using Unity version 2019.2 and they are using an older version. i am only using 2019.2 because the tutorial download said it required that version. I am on a windows 10 computer and the editor is Visual Studio 2019. here is the video if you need it:

Try namespace UnityEngine.UI not UnityEngine.UIElements.

I was facing the same problem and found this solution in StackOverflow.