Looking at the stacktrace, it seems like you actually have a null CommandBuffer attached to the camera - the null isn’t referring to the camera variable.
Sorry the error message isn’t very helpful - a bug report would still be useful to help us improve this. Not sure how/why a null CommandBuffer would be attached to the camera, or even if that’s something Unity should let you do.
Yes, I get the same error when a gameobject’s script containing an array of SO’s is displayed in the inspector. I changed it to a List instead of an array and that seems to have solved the problem.
Am on Unity 2022.3.34 (latest) and got this error too. Thought it was random but then realised that it was dependant on what item I had selected before I hit play.
Tracked it down to an exposed class in the component on the selected object
public StateHistory history = new();
The StateHistory class has a [Serializable] at the start so I can see the history in the inspector, but if I remove this Serializable attribute the crash at the start goes away. Seems to be an inspector issue with this kind of class.
[Serializable] // Remove this and the error goes away (and this history is not visible in the inspector
public class StateHistory
{
public const int historyLength = 10;
[Serializable]
public struct HistoryEntry
{
public string state;
public float time;
}
public List<HistoryEntry> history = new();
public void AddToHistory(string state)
{
if (history == null) history = new();
history.Insert(0, new HistoryEntry() { state = state, time = Time.time });
if (history.Count > historyLength)
{
history.RemoveAt(history.Count-1);
}
}
}