Recall & Review
beginner
What is component communication in Unity?
Component communication is how different scripts (components) on GameObjects talk to each other to share data or trigger actions.
Click to reveal answer
beginner
How do you get a reference to another component on the same GameObject?
Use
GetComponent<ComponentType>() to find and access another component on the same GameObject.Click to reveal answer
intermediate
What is the difference between
GetComponent and FindObjectOfType?GetComponent finds a component on the same GameObject, while FindObjectOfType searches the whole scene for a component of that type.Click to reveal answer
intermediate
How can components communicate without direct references?
They can use events, delegates, or messaging systems like
SendMessage to communicate without needing direct references.Click to reveal answer
intermediate
Why is it better to cache component references instead of calling
GetComponent repeatedly?Calling
GetComponent is slow if done often. Caching the reference once improves performance and keeps code cleaner.Click to reveal answer
Which method gets a component attached to the same GameObject?
✗ Incorrect
GetComponent<T>() finds a component of type T on the same GameObject.What does
SendMessage do in Unity?✗ Incorrect
SendMessage calls a method by name on all components attached to the GameObject.Why should you cache component references?
✗ Incorrect
Caching avoids repeated
GetComponent calls, which are slow.Which of these is NOT a way for components to communicate?
✗ Incorrect
Instantiate creates new objects, it does not help components communicate.What does
FindObjectOfType<T>() do?✗ Incorrect
FindObjectOfType<T>() searches the whole scene for a component of type T.Explain how two components on the same GameObject can communicate in Unity.
Think about how you find one component from another on the same object.
You got /3 concepts.
Describe different ways components can communicate without direct references.
Consider messaging systems or event-driven communication.
You got /4 concepts.