Consider this simple Unity script attached to a GameObject. What will be printed in the console when the game starts?
using UnityEngine; public class TestScript : MonoBehaviour { void Start() { Debug.Log("Game engine architecture overview"); } }
Start() is called once when the game begins for active GameObjects.
The Start() method runs once at the beginning, so the message is printed to the console.
In a typical game engine architecture, which component handles drawing objects on the screen?
Think about which part turns data into images you see.
The Rendering Engine draws graphics on the screen by processing models, textures, and lighting.
Examine the code below. Why does it cause a NullReferenceException when run?
using UnityEngine;
public class PlayerController : MonoBehaviour
{
public GameObject weapon;
void Start()
{
weapon.SetActive(true);
}
}Check if 'weapon' has a value before calling methods on it.
If 'weapon' is not assigned in the Unity Inspector, it remains null, so calling SetActive on it causes a NullReferenceException.
Find the syntax error in the following code snippet:
using UnityEngine; public class Enemy : MonoBehaviour { void Update() { if (health <= 0) Destroy(gameObject); } }
Check line endings carefully in C#.
In C#, statements must end with a semicolon. The Destroy(gameObject) call is missing a semicolon.
Most game engines have several main subsystems. How many are commonly considered core parts?
Think about rendering, physics, audio, input, and scripting.
Commonly, game engines have 5 main subsystems: Rendering, Physics, Audio, Input, and Scripting/Logic.