c#, Coroutines, unity

Coroutines in Unity3D

Objective : The objective of this blog is to learn about Coroutines and its uses in Unity3D. Introduction : Before jumping to Coroutines, let’s discuss why it is required ? and what makes it a powerful feature that can do wonder in unity. Unity is frame based.Unity does things each frame. Many processes in games take place over the course of multiple frames.Sometimes we got a dense process that takes a long time to finish, so during this time your game will run at low FPS(frames per second). so we have to find a way so that this process will not impact our game fps. One way is run this process on another thread, instead on the main thread. But Unity is single threaded. There is one main loop of Unity and all those functions that you write are being called by the same main thread in order. we can verify…

c#, unity, Unity Tutorials

Singleton : Implementation in Unity3d C#

Objective : Singleton is a very complex topic, In this, we try to understand basics and various implementation of Singleton in Unity3d using C#. Intro: Singleton is a basic Design Pattern. Classes implementing Singleton pattern will ensure that only one instance of the object ever exists at any one time. It is recommend using Singletons for things that do not need to be copied multiple times during a game.This is great for controller classes like GameManager or AudioController. Implementation: There are several ways of implementing Singleton in Unity, we will some of the implementation in this tutorial Simplest Implementation Above code is the simplest implementation of Singleton, but there are some issues which we have to address Singleton is not persistent across the Unity scenes. All the executable code must be attached to GameObject in the hierarchy. It is not recommended to call SingletonController.Instance in any Awake() method because, since we don’t know the…

c#, unity, unity tips and tricks, Unity Tutorials, unity3d

Difference Between Destroy and DestroyImmediate Unity Functions

Objective : Objective of this Tutorial is to understand diffence between Destroy and DestroyImmediate unity function Purpose of both function is same, to destoy gameobject, but there is very small difference, which is very crucial to understand, wrong use of these function can cause your app to crash So first of all little bit of theory and then some code Destroy() :  This just destroy the game object passed as parameter.  It set all the references to that game object to null at the end of frame. Syntax: Destroy(myGameObject); Let see it in code: Create new script and add this code and add it to Main Camera and click play, and just left click to create new game object and press space bar to destroy the game object and check the log in console window you will notice that first log print the status “true“, and second log print the name of currObject which…

c#, unity, Unity Interview Questions, Unity Tutorials, unity3d

Unity Interview Questions

In this, I am going to list some of the very commonly asked interview questions for unity developer profile. Unity Engine Specific Question : Difference between Update,Fixed Update and Late Update. What is Prefabs in Unity 3D? What is the use of AssetBundle in Unity? What is difference between Resources and StreamingAssets Folder. What is Batching and what is the use of Batching? Difference between Destroy and DestroyImmediate unity function Difference between Start and Awake Unity Events What is the use of deltatime? Is this possible to collide two mesh collider,if yes then How? Difference between Static and Dynamic Batching. What is the use of Occlusion Culling? How can you call C# from Javascript, and vice versa? Arrange the event functions listed below in the order in which they will be invoked when an application is closed: Update() OnGUI() Awake() OnDisable() Start() LateUpdate() OnEnable() OnApplicationQuit() OnDestroy() C# related Questions :  Difference between…