Search Unity

Feedback Trying to understand classes and deriving from them

Discussion in 'Scripting' started by AdamMCE, Jun 12, 2021.

  1. AdamMCE

    AdamMCE

    Joined:
    May 3, 2021
    Posts:
    18
    I might be making my attempt at understanding a bit more difficult than it needs to be, but I want to make sure I understand. So, example: there is a main script. This main script derives from monobehaviour. Now if I make a side script that derives from this main script, is this side script going to also derive from monobehaviour as well?

    I think I know the answer, but none of the tutorials I've been watching have covered this. Of anything I've said is wrong please feel free to correct as all I'm looking for is to better understand. Thank you!
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,752
    Yes. However there is hardly EVER a call to do this until you really really really really REALLY understand what it is you are trying to do. Lotsa people get all twangled up in OO when they overlook the basic reality that a component model approach is far more compatible with Unity's component model architecture.

    Basics of Unity GameObjects and Components:

     
    AdamMCE likes this.
  3. AdamMCE

    AdamMCE

    Joined:
    May 3, 2021
    Posts:
    18
    Thank you for the reply I appreciate it a lot! Definitely answered my question. I will definitely be giving that video a watch when I get the chance