Classes for Behaviors
Objective: Classes for Behaviors.
Before this lets understand this programming model called ,Object-Oriented Programming or OOPs refers to languages that use objects in programming.
class is the concept which give programmer ability's create object in programming world in order to organize code and reuse them in more organized way.
When creating a class understand you are creating a blueprint of that object .We create a behavior of that object ,we can use it attributes from different class or access its attribute in the same class.
Unity3d World
In unity when create class ,class Inherit MonoBehaviour, this means it can use MonoBehaviour method ,class and more. Also in unity when create a C# script in order to attach it to the game Object it must Inherit Monobehaviour.
Custom Class
These are class does not Inherit from MonoBehaviour.
Normally when we set variable in as public accessor we can see its attribute in the inspector ,but for custom you cant see them even if you set them to public. In order to see this we need to create a handle this class(Enemy) in other class(Test) .
We create this handle in this class in order to see the attribute of the custom class in the inspector you must create a handle or an Instance of that class (Custom class aka Enemy).
Note: You must associate our custom class with class attached to game Object to see custom class element to the Inspector.
Lets go the Unity Editor < Game Object <Attached Test script .But still custom attribute wont appear.
Solution .
To see Custom Attribute we must add square bracket with keyword [System.Serializable] After name spaces.
See you in the next one