All Unity messages should be protected. Unity messages do not need to be public for Unity to call them and are not meant to be called manually. Also, if a base class has a private message and a child class implements the same one, only the child one will be called without any notification or any way to call the base method.
You have to opt-in to use this analyzer (disabled by default). To enable it, you will need to add the following to your .editorconfig
file:
[*.cs]
dotnet_diagnostic.UNT0021.severity = suggestion
using UnityEngine;
class Camera : MonoBehaviour
{
public void Awake
{
}
}
Fix expression:
using UnityEngine;
class Camera : MonoBehaviour
{
protected void Awake
{
}
}
A code fix is offered for this diagnostic to automatically apply this change.