Search Unity

MonoBehaviour future

Discussion in 'General Discussion' started by Rivomist, Feb 13, 2019.

  1. Rivomist


    Oct 1, 2016
    As we all know Unity changed its development vector towards performance by reconstructing OOP-related MonoBehaviour into brand new (at least in terms of Unity) data related Entity Component Systems.

    So, now it comes to the question stated in thread title: what would happen with MonoBehaviour? Would it die just like Boo and JS did, or they're just fine with what MonoBehaviour represents nowdays and will maintain it in case some critical issues ought to be fixed? Or probably once ECS will reach the same functionality, both will evolve in parallel.

    If there's any official info related to this context please reply, or just ur thoughts about it.
    Last edited: Feb 13, 2019
  2. Lurking-Ninja


    Jan 20, 2015

    Everything and everyone die sooner or later.

    For a while. And then MonoBehaviour probably will die naturally (no one will use it). But this is many years in the future.

    In the mean time. MonoBehaviour IS NOT obsolete. (And this is the 666th thread about this nonsense).
    xVergilx, Kiwasi, Ryiah and 1 other person like this.
  3. Joe-Censored


    Mar 26, 2013
    Unity has a history of deprecating important features or platforms which fall out of mainstream use. I think UnityScript (JS) support is the closest comparison to MonoBehaviour. They continued supporting it for years after C# was added, and only deprecated it when its users dropped to low single digits, making it no longer cost effective to maintain. If 30% of Unity developers were using UnityScript instead of 3%, I'm certain UnityScript would still be part of the most recent Unity versions.

    So I think it all depends then on how many projects continue to use MonoBehaviour scripts. Seeing that virtually all existing tutorials, example code, and even forum help use MonoBehaviours you've got no short term risk of them falling out of favor. There's even an argument that MonoBehaviours are superior as far as the development side for a large number of projects (generally smaller projects, which won't benefit much from multicore efficiency, a space which Unity happens to dominate currently). So if I had to bet money I'd put it on MonoBehaviours not only still being around in 5 years, but still being the dominant way to use Unity.

    In the long run, Unity will use their analytics to determine how many projects are using MonoBehaviours, and if they drop to something like single digit percent usage don't be surprised to see a blog post titled "MonoBehaviour's long ride into the sunset", but I just wouldn't put my money on that happening in any timeframe that is meaningful for project planning today.
    Kiwasi, Ryiah, Rivomist and 1 other person like this.
  4. Antypodish


    Apr 29, 2014
    This is and may be true, as long / until, new tools arrive, which will provide equivalent (tasks and proficiency), what MonoBehaviour does.

    Which in short, is quite far of yet.
    Ryiah and Joe-Censored like this.
  5. Kiwasi


    Dec 5, 2013
    We don't even know if ECS is a real thing yet. Is it even out of preview? I'd give it a couple of years before we can be confident its not going to go the same way as uNet.

    If ECS becomes a thing, and developers start using it, and developers stop using MonoBehaviour, and MonoBehaviour is slowing further engine development, then MonoBehaviour will be removed. That is a long change of ifs. Its going to take at least 5-10 years to make it though that list.

    Also, none of the signs that accompanied the demise of UnityScript have shown up yet. These included:
    • A massive community preference for C# (you couldn't post a UnityScript question on the forums without five posts saying "USE C#", and several comments saying "I don't understand UnityScript").
    • A lack of documentation, tutorials and general support for UnityScript
    • Not a single mention of UnityScript at Unite, for several years running
    • New features not implemented in UnityScript
    • The appearance of features designed to aid removing UnityScript (like when they changed the documentation to accept C# first).
    You've still got 5-10 years. And fairly good odds on getting another decade beyond that.
    Antypodish, Joe-Censored and Ryiah like this.
  6. Billy4184


    Jul 7, 2014
    If it becomes obsolete, it should be gotten rid of. But I doubt very much that Monobehaviours will go anywhere. Despite the performance limitations and the sometimes awkwardness of it, I think it will be far easier especially for beginners to grasp than ECS. Anytime you decouple and abstract things, you gain flexibility but you lose structural identity - and add to mental workload.
    TenKHoursDev, Kiwasi and Joe-Censored like this.
  7. AndersMalmgren


    Aug 31, 2014
    What bothers me most with it is the name. :)
  8. Murgilod


    Nov 12, 2013
    Even if Unity plans on getting rid of monobehaviour, it'll likely exist a few years after ECS is implemented and in a complete, usable state. Like, if we somehow got full ECS support by 2019.4 (not happening), I would not expect to see monobehaviour deprecated until 2025 at the earliest. These are my estimations for the absolute fastest deprecation too, it'll likely be far longer.

    This is nothing to worry about now or even likely in the dev period of any projects anyone is currently working on.