Search Unity

Monobehaviour

Discussion in 'Documentation' started by andyz, May 20, 2022.

  1. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,276
    https://docs.unity3d.com/ScriptReference/MonoBehaviour.html

    "MonoBehaviour is the base class from which every Unity script derives.
    When you use C#, you must explicitly derive from MonoBehaviour."


    So... I added feedback on this. They are untrue statements if a script is a C# file.
    A C# file may contain a class not derived from Monobehaviour and be part of, and used by, a Unity project.

    Yes you will use Monobehaviours but not all classes will be derived from
     
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    Yeah, it's a holdout from the ancient times when there was a bunch of different programming languages available for Unity. See the same entry in the documentation from Unity 5 here:

    "Using Javascript every script automatically derives from MonoBehaviour. When using C# or Boo you have to explicitly derive from MonoBehaviour."

    The people maintaining the docs has just removed the mentions of the removed languages as they got removed, without actually thinking about what the sentence they were editing was trying to convey. Great job.
     
    andyz likes this.