How can I fix this?

I get this error:
Assets/PlayerSetup.cs(25,45): error CS0176: Static member `UnityEngine.Camera.main’ cannot be accessed with an instance reference, qualify it with a type name instead

Here is my script:

using UnityEngine;
using UnityEngine.Networking;

public class PlayerSetup : NetworkBehaviour {

[SerializeField]
Behaviour[] componentsToDisable;

Camera sceneCamera;

void Start () 
{
	if (!isLocalPlayer) 
	{
		for (int i = 0; i < componentsToDisable.Length; i++) 
		{
			componentsToDisable*.enabled = false;*
  •   	}*
    
  •   }* 
    
  •   else* 
    
  •   {*
    
  •   	sceneCamera = Camera.main;*
    
  •   	if (sceneCamera != null)*
    
  •   	{*
    
  •   		sceneCamera.main.gameObject.SetActive(false);*
    
  •   	}*
    
  •   }*
    
  • }*
  • void OnDisable ()*
  • {*
  •   if (sceneCamera != null)* 
    
  •   {*
    
  •   	sceneCamera.gameObject.SetActive(false);*
    
  •   }*
    
  • }*
    }

Camera.main is a static method, you should call it with the class’ name “Camera” and not with an object of the class.

     if (Camera.main != null)
     {
         Camera.main.gameObject.SetActive(false);
     }

but im not sure what you try to archive with this, and I’m unsure if this is a good way to do what you want it to do