Unity 3D Interview Questions & Answers

  1. Question 1. Explain What Is Prefabs In Unity 3d?

    Answer :

    Prefab in Unity 3D is referred for pre-fabricated object template (Class combining objects and scripts). At design time, a prefab can be dragged from project window into the scene window and added the scene’s hierarchy of game objects. If desired the object then can be edited.

    At the run time, a script can cause a new object instance to be created at a given location or with a given transform set of properties.

  2. Question 2. Mention What Is The Function Of Inspector In Unity 3d?

    Answer :

    The inspector is a context-sensitive panel, where you can adjust the position, scale and rotation of Game Objects listed in Hierarchy panel.

  3. Game Developing Interview Questions

  4. Question 3. What’s The Best Game Of All Time And Why?

    Answer :

    The most important thing here is to answer relatively quickly, and back it up. One of the fallouts of this question is age. Answering “Robotron!” to a 20-something interviewer might lead to a feeling of disconnect. But sometimes that can be good. It means you have to really explain why it’s the best game of all time. Can you verbally and accurately describe a game to another person who has never played it? You’ll rack up some communication points if you can.

    What you shouldn’t say is whatever the latest hot game is, or blatantly pick one that the company made (unless it’s true and your enthusiasm is bubbling over). Be honest. Don’t be too eccentric and niche, and be ready to defend your decision.

  5. Question 4. List Out The Pros And Cons Of Unity 3d?

    Answer :

    Pros:

    ► It uses JavaScript and C# language for scripting
    ► Unity provides an Asset store where you can buy or find stuff, that you want to use in your games
    ► You can customize your own shaders and change the way how Unity renders the game
    ► It is great platform for making games for mobile devices like iOS, Android and Web (HTML5)

    Cons:

    ► Compared to Unreal Engine it has got low graphics quality
    ► Interface not user-friendly and it is hard to learn especially for beginners
    ► It requires good programming knowledge as such most of the stuff runs on Scripts.

  6. Game Developing Tutorial

  7. Question 5. What Are The Characteristics Of Unity3d?

    Answer :

    Characteristics of Unity is:

    It is a multi-platform game engine with features like ( 3D objects, physics, animation, scripting, lighting etc.)

    ► Accompanying script editor
    ► MonoDevelop (win/mac)
    ► It can also use Visual Studio (Windows)
    ► 3D terrain editor
    ► 3D object animation manager
    ► GUI System
    ► Many platforms executable exporter Web player/ Android/Native application/Wii
    In Unity 3D, you can assemble art and assets into scenes and environments like adding special effects, physics and animation, lighting, etc.

  8. Android Interview Questions

  9. Question 6. List Out Some Best Practices For Unity 3d?

    Answer :

     ► Cache component references: Always cache reference to components you need to use your scripts

    ► Memory Allocation: Instead of instantiating the new object on the fly, always consider creating and using object pools. It will help to less memory fragmentation and make the garbage collector work less

    ► Layers and collision matrix: For each new layer, a new column and row are added on the collision matrix. This matrix is responsible for defining interactions between layers

    ► Raycasts: It enables to fire a ray on a certain direction with a certain length and let you know if it hit something

    ► Physics 2D 3D: Choose physics engine that suits your game

    ► Rigidbody: It is an essential component when adding physical interactions between objects

    ► Fixed Timestep: Fixed timestep value directly impacts the fixedupdate() and physics update rate.

  10. Question 7. How Do You Feel About Crunching?

    Answer :

    At smaller studios, this is the 64 million dollar question. My advice is to be 100 percent honest. If you won’t crunch, say so now. It may well put you out of the running for a job, but ultimately that’s a good thing. No, really, it is! If the company works a lot of overtime and you don’t want to do it, then taking the job is going to be punishing for everyone.

    Having said that, the last thing any interviewer wants to hear is, “I won’t do it” because that predicates a perceived lack of involvement and passion (not that passion should equal overtime, but the perception of refusing to do something before you’re even in the circumstances could be the difference between getting a job offer and having the company pass you up).

     

  11. Android Tutorial
    3D Animation Interview Questions

  12. Question 8. Explain What A Vertex Shader Is, And What A Pixel Shader Is?

    Answer :

    Vertex shader is a script that runs for each vertex of the mesh, allowing the developer to apply transformation matrixes, and other operations, in order to control where this vertex is in the 3D space, and how it will be projected on the screen.

    Pixel shader is a script that runs for each fragment (pixel candidate to be rendered) after three vertexes are processed in a mesh’s triangle. The developer can use information like the UV / TextureCoords and sample textures in order to control the final color that will be rendered on screen.

  13. Question 9. Explain Why Vectors Should Be Normalized When Used To Move An Object?

    Answer :

    Normalization makes the vector unit length. It means, for instance, that if you want to move with speed 20.0, multiplying speed * vector will result in a precise 20.0 units per step. If the vector had a random length, the step would be different than 20.0 units.

  14. Maya 3D Interview Questions

  15. Question 10. Explain Why Deferred Lighting Optimizes Scenes With A Lot Of Lights And Elements?

    Answer :

    During rendering, each pixel is calculated whether it should be illuminated and receive lightning influence, and this is repeated for each light. After approximately eight repeated calculations for different lights in the scene, the overhead becomes significant.

    For large scenes, the number of pixels rendered is usually bigger than the number of pixels in the screen itself.

    Deferred Lighting makes the scene render all pixels without illumination (which is fast), and with extra information (at a cost of low overhead), it calculates the illumination step only for the pixels of the screen buffer (which is less than all pixels processed for each element). This technique allow much more light instances in the project.

  16. Javascript Advanced Tutorial

  17. Question 11. Can Two Gameobjects, Each With Only An Spherecollider, Both Set As Trigger And Raise Ontrigger Events? Explain Your Answer?

    Answer :

    No. Collision events between two objects can only be raised when one of them has a RigidBody attached to it. This is a common error when implementing applications that use “physics.”

  18. Mobile Device Management Interview Questions

  19. Question 12. Explain What Is An Unity3d File And How Can You Open A Unity3d File?

    Answer :

    A Unity3D files are scene web player files created by Unity; an application used to develop 3D games. These files consist of all assets and other game data in a single archive, and are used to enable gameplay within a browser that has the Unity Web Player Plugin. The assets within a 3D unity file are saved in a proprietary closed format.

  20. Game Developing Interview Questions

  21. Question 13. Explain What Is Fixed Timestep In Unity3d? Why Does Fixed Timestep Setting Affect Game Speed?

    Answer :

    Fixed Timestep feature helps to set the system updates at fixed time interval. A queue like mechanism will manage all real-time events that are accumulated between time epochs. If frame-rate drops below some threshold limit set for fixed timestep, then it can affect the game speed.

  22. Unittest Framework Tutorial

  23. Question 14. Explain, In A Few Words, What Roles The Inspector, Project And Hierarchy Panels In The Unity Editor Have. Which Is Responsible For Referencing The Content That Will Be Included In The Build Process?

    Answer :

    The inspector panel allows users to modify numeric values (such as position, rotation and scale), drag and drop references of scene objects (like Prefabs, Materials and Game Objects), and others. Also it can show a custom-made UI, created by the user, by using Editor scripts.

    The project panel contains files from the file system of the assets folder in the project’s root folder. It shows all the available scripts, textures, materials and shaders available for use in the project.

    The hierarchy panel shows the current scene structure, with its GameObjects and its children. It also helps users organize them by name and order relative to the GameObject’s siblings. Order dependent features, such as UI, make use of this categorization. 

    The panel responsible for referencing content in the build process is the hierarchy panel. The panel contains references to the objects that exist, or will exist, when the application is executed. When building the project, Unity searches for them in the project panel, and adds them to the bundle.

  24. Question 15. Explain Why Time.deltatime Should Be Used To Make Things That Depend On Time Operate Correctly?

    Answer :

    Real time applications, such as games, have a variable FPS. They sometimes run at 60FPS, or when suffering slowdowns, they will run on 40FPS or less.

    If you want to change a value from A to B in 1.0 seconds you can’t simply increase A by B-A between two frames because frames can run fast or slow, so one frame can have different durations.

    The way to correct this is to measure the time taken from frame X to X+1 and increment A, leveraging this change with the frame duration deltaTime by doing A += (B-A) * DeltaTime.

    When the accumulated DeltaTime reaches 1.0 second, A will have assumed B value.

  25. 3DSMAX Interview Questions

  26. Question 16. 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()

    Answer :

    The correct execution order of these event functions when an application closes is as follows:

    Awake()
    OnEnable()
    Start()
    Update()
    LateUpdate()
    OnGUI()
    OnApplicationQuit()
    OnDisable()
    OnDestroy()

    Note: You might be tempted to disagree with the placement of OnApplicationQuit() in the above list, but it is correct which can be verified by logging the order in which call occurs when your application closes.

  27. Question 17. Consider The Following Code Snippet Below:

    Class Mover : Monobehaviour
    {
    Vector3 Target;
    Float Speed;

    Void Update()
    {

    }
    }
    Finish This Code So The Gameobject Containing This Script Moves With Constant Speed Towards Target, And Stop Moving Once It Reaches 1.0, Or Less, Units Of Distance?

    Answer :

    class Mover : MonoBehaviour
    {

    Vector3 target;
    float speed;

    void Update()
    {
    float distance = Vector3.Distance(target,transform.position);
    // will only move while the distance is bigger than 1.0 units
    if(distance > 1.0f)
    {
    Vector3 dir = target – transform.position;
    dir.Normalize(); // normalization is obligatory
    transform.position += dir * speed * Time.deltaTime; // using deltaTime and speed is obligatory

    }
    }

  28. Javascript Advanced Interview Questions

  29. Question 18. Can Threads Be Used To Modify A Texture On Runtime?
    Can Threads Be Used To Move A Gameobject On The Scene?
    Consider The Snippet Below:
    Class Randomgenerator : Monobehaviour
    {
    Public Float[] Randomlist;

    Void Start()
    {
    Randomlist = New Float[1000000];

    }

    Void Generate()
    {
    System.random Rnd = New System.random();
    For(int I=0;i
    }
    }
    Improve This Code Using Threads, So The 1000000 Random Number Generation Runs Without Spoiling Performance.

    Answer :

    No. Texture and Meshes are examples of elements stored in GPU memory and Unity doesn’t allow other threads, besides the main one, to make modifications on these kinds of data.

    No. Fetching the Transform reference isn’t thread safe in Unity.

    When using threads, we must avoid using native Unity structures like the Mathf and Random classes:

    1. class RandomGenerator : MonoBehaviour
    2. {
    3. public float[] randomList;
    4. void Start()
    5. {
    6. randomList = new float[1000000];
    7. Thread t = new Thread(delegate()
    8. {
    9. while(true)
    10. {
    11. Generate();
    12. Thread.Sleep(16); // trigger the loop to run roughly every 60th of a second
    13. });
    14. t.Start();
    15. }
    16. void Generate()
    17. {
    18. System.Random rnd = new System.Random();
    19. for(int i=0;i
    20. }
    21. }
  30. Android Interview Questions

  31. Question 19. Explain The Issue With The Code Below And Provide An Alternative Implementation That Would Correct The Problem.
    Using Unityengine;
    Using System.collections;
    Public Class Test : Monobehaviour {
    Void Start () {
    Transform.position.x = 10;
    }
    }

    Answer :

    The issue is that you can’t modify the position from a transform directly. This is because the position is actually a property (not a field). Therefore, when a getter is called, it invokes a method which returns a Vector3 copy which it places into the stack.

    So basically what you are doing in the code above is assigning a member of the struct a value that is in the stack and that is later removed.

    Instead, the proper solution is to replace the whole property; e.g.:

    using UnityEngine;
    using System.Collections;
    public class TEST : MonoBehaviour {
    void Start () {
    Vector3 newPos = new Vector3(10, transform.position.y, transform.position.z);
    transform.position = newPos;
    }
    }

  32. Question 20. List Out Some Key Features Of Unity3d Ue4 ( Unreal Engine 4)?

    Answer :

    UE4:

    ► Game logic is written in C++ or blueprint editor
    ► Base scene object- Actor
    ► Input Events- Component UInputComponent of Actor class
    ► Main classes and function of UE4 includes int32,int24, Fstring, Ftransform, FQuat, FRotator, Actor and TArray
    ► To create a new instance of a specified class and to point towards the newly created Actor. UWorld::SpawnActor() may be used
    ► UI of Unreal Engine 4 is more flexible and less prone to crashes
    ► It does not support systems like X-box 360 or PS3, it requires AMD Radeon HD card to function properly
    ► Less expensive compare to Unity3D
    ► To use UE4 you don’t need programming language knowledge

    Unity3D:

    ► Game logic is written using the Mono environment
    ► Base scene object- GameObject
    ► Input events- Class Input
    ► Main classes and function include int,string,quaternion,transform, rotation, gameobject, Array
    ► To make a copy of an object you can use the function Instantiate()
    ► The asset store of this tool is much better stacked than UE4
    ► It supports wide range of gaming consoles like X-box and PS4, as well as their predecessors
    ► Unity3D has free version which lacks few functionality while pro version is bit expensive in compare to UE4
    ► It requires programming language knowledge.

  33. Game Graphics Designer Interview Questions

  34. Question 21. Explain What Is The Use Of Assetbundle In Unity3d?

    Answer :

    AssetBundles are files that can be exported from Unity to contain asset of your choice. AssetBundles are created to simply downloading content to your application.

  35. Question 22. In Unity 3d How Can You Hide Gameobject?

    Answer :

    To hide gameobject in Unity 3D, you have to use the code

    gameObject.transform.SetActive(false);

  36. Question 23. Mention Important Components Of Unity 3d?

    Answer :

    Some important Unity 3D components include:

    ► Toolbar: It features several important manipulation tools for the scene and game windows.

    ► Scene View: It is a fully rendered 3 D preview of the currently open scene is displayed and enables you to add, edit and remove GameObjects

    ► Hierarchy: It displays a list of every GameObject within the current scene view

    ► Project Window: In complex games, project window searches for specific game assets as needed. It explores the assets directory for all textures, scripts, models and prefabs used within the project

    ► Game View: In unity you can view your game and at the same time make changes to your game while you are playing in real time.

  37. Unittest Framework Interview Questions

  38. Question 24. What Is Unity 3d?

    Answer :

    Unity 3D is a powerful cross-platform and fully integrated development engine which gives out-of-box functionality to create games and other interactive 3D content.

  39. 3D Animation Interview Questions