Quote:
UnityException: RandomRangeInt is not allowed to be called from a MonoBehaviour constructor (or instance field initializer), call it in Awake or Start instead. Called from MonoBehaviour 'wall' on game object 'Wall'.
You are trying to use it in your instance initializer:
private int ranXPos = Random.Range(-5, 6);
So move the initialization to your Start method.
private int ranXPos;
void Start()
{
ranXPos = Random.Range(-5, 6);
transform.position = new Vector3(ranXPos, spawnPoint.y, spawnPoint.z);
camPos = GameObject.Find("Main Camera").GetComponent<Transform>();
}