I'm pretty sure this is a bug but here's a shorted version of my code:
This is the script where I want the bool to be in:
namespace UnityStandardAssets.Characters.FirstPerson
{
public class FirstPersonController : MonoBehaviour
{
private Camera m_Camera;
private bool isReload;
private GameObject PlayerCamera;
private void Start()
{
m_Camera = Camera.main;
PlayerCamera = GameObject.Find("PlayerCamera");
isReload = PlayerCamera.GetComponent().isReloading;
}
}
This is the Script where the bool comes from:
public class GunScript : MonoBehaviour
{
public bool isReloading;
}
obviously this is not all the code, but this is the part with the problem.
Now my Visual Studio says that
> Error CS0246 The type or namespace name "GunScript" could not be found (a using directive or assembly reference may be missing)
and I don't understand why I can't access it. The charactercontroller and other components get accessed without problems but my own Scripts don't work.
I included "m_Camera" because that's the GameObject where my GunScript is on, and I first tried:
isReload = m_Camera.GetComponent().Reloading;
and I had the same issue
Update: After trying to fix the issue a bit more, I think it definetly is because of the namespace used. How should I get the bool else? I don't want to redo my whole reloading logic in the player movement script.
↧