Prefab script member values not correct
In my scene I have a muzzle object parented to a gun, and the gun is parented to the player. As scene objects, everything was working fine, but when I converted the gun to a prefab the member variables become incorrect. The gun prefab is assigned to a PlayerScript.cs in the inspector and instantiated like this:Instantiate(m_shotgun, transform.position, transform.rotation);
The gun prefab then has a script with public bool m_canShoot = true;
. Even though it is never assigned to false and the inspector says it is true, the debugger has it as false. Weirdly enough this value is correct in the "Update" function but not in the ShootGun function.
My input manager is retrieving the gun prefab from the PlayerScript.cs, then calling the ShootGun public function. How can this value be false?