Unity Function === ## List #### LifeCycle function 1. [Awake()](#Awake) 2. [OnEnable()](#OnEnable) 3. [Start()](#Start) 4. [FixedUpdate()](#FixedUpdate) 5. [Update()](#Update) 6. [LateUpdate()](#LateUpdate) 7. [OnDisable()](#OnDisable) 8. [OnDestroy()](#OnDestroy) #### Method 1. [DontDestroyOnLoad()](#DontDestroyOnLoad) 2. [GetComponent()](#GetComponent) 3. [Physics2D.LineCast()](#LineCast) #### Option 1. [HideInInspector](#HideInInspector) ## Function ### LifeCycle function #### Awake() <a id="Awake"></a> Call only once when first time exec script.<br>Call it after all objs initiated.<br>**※ Can't use Coroutine**<br> ```csharp= void Awake() {} ``` <br> #### OnEnale <a id="onEnable"></a> Call every time when activate objs.<br> ```csharp= void OnEnable() {} ``` <br> #### Start <a id="Start"></a> Call only once before update. Must script activated. ```csharp= void Start() {} ``` <br> #### FixedUpdate<a id="FixedUpdate"></a> Call at regular intervals.<br>Using for Physics System. ```csharp= void FixedUpdate() {} ``` <br> #### Update<a id="Update"></a> Call it every frames.<br>Using with core logics. ```csharp= void Update() {} ``` <br> #### LateUpdate<a id="LateUpdate"></a> Call after Update.<br>Usually using for moving camera. ```csharp= void Update() {} ``` <br> #### OnDisable<a id="onDisable"></a> Call when de-activating objs.<br>**※Can't use Coroutine** ```csharp= void OnDisable() {} ``` <br> #### OnDestroy<a id="OnDestroy"></a> Call after last frame update in objs life. (Object.Destroy or Scene ends) ```csharp= void OnDestroy() {} ``` <br> ### Method #### DontDestroyOnLoad<a id="DontDestroyOnLoad"></a> All Objs destroyed when scene ends.<br>But sometimes objs are needed after scene.<br>`DontDestroyOnLoad()` give objs to next scene put in DontDestroyOnLoad scene. ```csharp= void DontDestroyOnLoad(GameObject obj); ``` <br> #### GetComponent<a id="GetComponent"></a> Get component with name of component.<br> ```csharp= <T> GetComponent<T> (GameObject obj); ``` <br> #### Physics2D.LineCast<a id="LineCast"/> Get hitting information with one line and collider in 2D. ```csharp= RaycastHit2d Physcis2D.LineCast(Vetor2 start, Vector2 end, int LayerMask = defualtMask, float minDepth = -Mathf.Infinity, float maxDepth = Mathf.Infinity); ``` ※ [**RaycastHit2D**](https://docs.unity3d.com/ScriptReference/RaycastHit2D.html) <br><br> ### Option #### HideInInspector Hide setting option in inspector window.<br>Use for no control in inspector ```csharp= [HideInInspector]protected int value = 3; ```