In a Unity scene, I define four objects: Obj-A, Obj-B, Obj-C, and Obj-D. Each has the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In a Unity scene, I define four objects: Obj-A, Obj-B, Obj-C, and Obj-D. Each has the following corresponding script: public class ObjAScript : MonoBehaviour { GameObject obj; ObjDScript scpt; void Start() { } } obj = GameObject. Find("Obj-D"); obj.AddComponent<ObjCScript>(); } public class ObjBScript : MonoBehaviour { GameObject obj; ObjCScript scpt; void Start() { scpt = obj.GetComponent<ObjDScript>(); } obj = GameObject.CreatePrimitive (PrimitiveType.Sphere); obj. AddComponent<ObjCScript>(); scpt = GameObject. Find("Obj-C"). GetComponent <ObjCScript>(); Destroy(gameObject. GetComponent<ObjBScript>()); // this deletes a component } public class ObjCScript : MonoBehaviour { void Start() { gameObject.AddComponent<ObjDScript> (); GameObject.CreatePrimitive(PrimitiveType.Sphere); } public class pbjDScript: MonoBehaviour { void Update() { transform. localPosition += Vector3.right * 0.1f; } Please answer the following questions based on the running of this scene. Question 1 How many GameObjects will there be? 3 pts Question 1 How many GameObjects will there be? Question 2 How many instances of ObjAScript will there be? Question 3 The instances of ObjAScript are components of Obj-A Obj-B Obj-C Obj-D None of the above Question 4 How many instances of ObjBScript will there be? Question 5 The instances of ObjBScript are components of Obj-A Obj-B Obj-C Obj-D None of the above Question 6 How many instances of ObjCScript will there be? The instances of ObjCScript are components of Obj-A Obj-B Obj-C Obj-D None of the above Question 8 How many instances of ObjDScript will there be? Question 9 The instances of ObjDScript are components of obj-A obj-B obj-C obj-D None of the above In a Unity scene, I define four objects: Obj-A, Obj-B, Obj-C, and Obj-D. Each has the following corresponding script: public class ObjAScript : MonoBehaviour { GameObject obj; ObjDScript scpt; void Start() { } } obj = GameObject. Find("Obj-D"); obj.AddComponent<ObjCScript>(); } public class ObjBScript : MonoBehaviour { GameObject obj; ObjCScript scpt; void Start() { scpt = obj.GetComponent<ObjDScript>(); } obj = GameObject.CreatePrimitive (PrimitiveType.Sphere); obj. AddComponent<ObjCScript>(); scpt = GameObject. Find("Obj-C"). GetComponent <ObjCScript>(); Destroy(gameObject. GetComponent<ObjBScript>()); // this deletes a component } public class ObjCScript : MonoBehaviour { void Start() { gameObject.AddComponent<ObjDScript> (); GameObject.CreatePrimitive(PrimitiveType.Sphere); } public class pbjDScript: MonoBehaviour { void Update() { transform. localPosition += Vector3.right * 0.1f; } Please answer the following questions based on the running of this scene. Question 1 How many GameObjects will there be? 3 pts Question 1 How many GameObjects will there be? Question 2 How many instances of ObjAScript will there be? Question 3 The instances of ObjAScript are components of Obj-A Obj-B Obj-C Obj-D None of the above Question 4 How many instances of ObjBScript will there be? Question 5 The instances of ObjBScript are components of Obj-A Obj-B Obj-C Obj-D None of the above Question 6 How many instances of ObjCScript will there be? The instances of ObjCScript are components of Obj-A Obj-B Obj-C Obj-D None of the above Question 8 How many instances of ObjDScript will there be? Question 9 The instances of ObjDScript are components of obj-A obj-B obj-C obj-D None of the above
Expert Answer:
Answer rating: 100% (QA)
Based on the given Unity scripts and the scene setup lets answer each question one by one Question 1 How many Game Objects will there be ObjA creates ... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
A partnership begins its first year of operations with the following capital balances: Allegan, Capital Berrien, Capital $ 50,000 40,000 50,000 Kent, Capital According to the articles of partnership,...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Q1. i. Define a base class with following member data and member function: int i, j accessible in base class. void set(int a, int b) to initialize i .j. void show() to display the values of i, j. ii....
-
If North American wholesalers buy roses at the lowest possible price, how many do they buy from local growers and how many do they import?
-
Balmoral Limited purchased equipment on January 1, 2013, for $170,000 on account. At that time, the equipment was estimated to have a useful life of five years and a $2,000 residual value. The...
-
Pengo Ltd. owns land that it purchased at a cost of 400 million in 2020. The company chooses to use revaluation accounting to account for the land. The lands value fluctuates as follows (all amounts...
-
What response the opponent should make to a summary judgment motion?
-
Montrose Manufacturing is considering two potential investments. Each project will cost $ 115,000 and have an expected life of five years. The CFO has estimated the probability distributions for each...
-
Review the resources in the required unit resources of this unit to examine the 2020 Black Lives Matter (BLM) national protest in comparison to the 1992 Los Angeles riots. As you research, you may...
-
5. Let H be the linear space of matrices 2x2 over the field of real numbers. 1) Find the basis and dimension of the L(A1, A2, A3, A4) subset of H spanned by the following matrices: -1 1 1 -20 ^ - ( 2...
-
Discuss the role of linear programming in project management and how it can be used to optimize resource allocation and scheduling.
-
The function f(x) = 2x - x2 is given graphed below: Note: Click on graph for larger version in new browser window. (A) Starting with the formula for f(x), find a formula for g(x), which is graphed...
-
OA solid object has an apparent weight 15.2 N when completely submerged in ethyl alcohol (density 790) and 13.7 N when completely submerged in water. Find the volume of the object.
-
What is Business Management? Business Management is the process of developing and executing a plan to achieve objectives and success in an organization.
-
A diver leaves a 3-m board on a trajectory that takes her 2.2m above the board and then into the water 2.6m horizontally from the end of the board. a) At what speed did she leave the board? Express...
-
Define the word Accuracy?
-
A sprinkler head malfunctions at midfield in an NFL football field. The puddle of water forms a circular pattern around the sprinkler head with a radius in yards that grows as a function of time, in...
-
Write a fragment of code that computes the final score of a baseball game. Use a loop to read the number of runs scored by both teams during each of nine innings. Display the final score afterwards.
-
Write some Java statements that use the String methods indexOf and substring to find the first word in a string. We define word to be a string of characters that does not include whitespace. For...
-
Create a class that represents a grade distribution for a given course. Write methods to perform the following tasks: Set the number of each of the letter grades A, B, C, D, and F. Read the number of...
-
Justify the statement: Osmosis is of paramount importance in biological systems.
-
The freezing point of pure benzene is \(5.44^{\circ} \mathrm{C}\) and that of the solution containing \(2.092 \mathrm{~g}\) of benzaldehyde in \(100 \mathrm{~g}\) of benzene is \(4.44^{\circ}...
-
The molality of dissolved gases in water at \(0^{\circ} \mathrm{C}\) and \(1 \mathrm{~atm}\) is \(1.29 \times 10^{-3}\). The decrease in volume during melting of ice is \(0.0907 \mathrm{cc} /...
Study smarter with the SolutionInn App