Which of the following examples will run faster?
1000 GameObjects, each with a MonoBehaviour implementing the Update callback.
One GameObject with one MonoBehaviour with an Array of 1000 classes, each implementing a custom Update() callback?
Submitted by: MuhammadThe correct answer is 2.
The Update callback is called using a C# Reflection, which is significantly slower than calling a function directly. In our example, 1000 GameObjects each with a MonoBehaviour means 1000 Reflection calls per frame.
Creating one MonoBehaviour with one Update, and using this single callback to Update a given number of elements, is a lot faster, due to the direct access to the method.
Submitted by: Muhammad
The Update callback is called using a C# Reflection, which is significantly slower than calling a function directly. In our example, 1000 GameObjects each with a MonoBehaviour means 1000 Reflection calls per frame.
Creating one MonoBehaviour with one Update, and using this single callback to Update a given number of elements, is a lot faster, due to the direct access to the method.
Submitted by: Muhammad
Read Online Unity 3D Developer Job Interview Questions And Answers
Top Unity 3D Developer Questions
☺ | Explain what is Prefabs in Unity 3D? |
☺ | List out some best practices for Unity 3D? |
☺ | What's the best game of all time and why? |
☺ | Mention what is the function of Inspector in Unity 3D? |
☺ | List out the pros and cons of Unity 3D? |
Top Application Program Categories
☺ | AutoCAD Interview Questions. |
☺ | Microsoft Office Interview Questions. |
☺ | Microsoft Outlook Interview Questions. |
☺ | Microsoft Excel Interview Questions. |
☺ | WPF Interview Questions. |