WorksheetsC# - Unity Quiz
Total questions: 13
Worksheet time: 13mins
If you want to apply Gravity what component would you want to add to a gameobject?
RigidBody(2d or 3d)
Image
A Custom Script
Box Collider
What is the section called where all your GameObjects are housed?
Game
Inspector
Hierarchy
Console
In code what line of code would you use to access a component on the Gameobject the script is attached to?
accessComponent(component)
getcomponent(component)
findComponent(component)
On UI what is the component called that houses the UI?
Container
UI Holder
Canvas
What is the output of this code?
x=56;
//x=2;
x+=9;
print(x)
Error
65
66
11
To add a particle effect how would you instantiate the effect?
Instantiate a prefab of the object by calling Instantiate(obj, place, rotation)
Check the instantiate effect button.
Call the summon function and summon the particle effect by typing Summon(obj)
Leave the effect in the scene and it will instantiate itself
How would you declare a function that has no return and is public?
function MyFunction()
public void MyFunction()
public MyFunction()
MyFunction:
How would you check for a key input from the player (Old Input System)?
Adding the on key down component to an object
Using the if key down function
Using an if statement inside an update function
How would you call a function?
MyFunction()
Call(MyFunction)
StartCourotine(
MyFunction)
How many times do YOU call the start function?
1
Never
3
However many times I want
How do you create and define a variable of type string?
str myVariable = Hello World
str myVariable = "Hello World"
string myVariable = "Hello World"
string myVariable = Hello World
How many times is the UPDATE function called?
Once every frame
Whenever I call it in code
Once every second
Twice a frame
What is the correct way to delay code?
Calling an IEnumerator function
Typing delay(x)
delayCode(x)
