简体   繁体   中英

why i am getting error 'ObjectPoolingManager.Instance' is inaccessible due to its protection level?

My player script

Error CS0122: 'ObjectPoolingManager.Instance' is inaccessible due to its protection level

Code:

// Update is called once per frame
void Update () 
{
    if (Input.GetMouseButtonDown(0)) 
    {
        ObjectPoolingManager.Instance.GetBullet ();

        GameObject bulletObject = Instantiate (bulletPrefab);
        bulletObject.transform.position = playerCamera.transform.position + playerCamera.transform.forward;
        bulletObject.transform.forward = playerCamera.transform.forward;
    }
}

In your class declaration, you must have made it Internal class ObjectPoolingManager() You can make it accessible by changing it to Public class ObjectPoolingManager()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM