Hello, I am following the tank tutorial and I don’t understand the TankManager code. (details are not important)
I have a class named TankManager in which we define
[HideInInspector] public GameObject m_Instance;
and after we use this instance to do
m_Shooting = m_Instance.GetComponent<TankShooting>();
m_CanvasGameObject = m_Instance.GetComponentInChildren<Canvas>().gameObject;
I don’t understand the last 2 lines of code. How does this work? m_Instance has no value so how GetComponent is able to find TankShooting? TankShooting is not in my hierarchy, nor is Canvas. It’s like the script knows that we want m_Instance to be an instance of a tank, but we never did that in the code.