Question: Q . 1 . ( i ) Write a C# Monobehaviour script to attach to a Unity 3 D game object which automatically destroys the

Q.1.(i) Write a C# Monobehaviour script to attach to a Unity3D game object which automatically destroys the object as soon as it is either behind the camera or more than a defined distance away from it. This defined distance should be available as a value that can be edited in the inspector. [8](ii) What are C# Coroutines? [2](iii) Write a Coroutine which carries out a sequence of actions over time: [8] Gradually (frame by frame) moves its local game object at a speed of 1 metre per second towards a Vector3 position. After the game object arrives at the position, waits 2 seconds. Then moves the game object in the same way to a second Vector3 position. Your Coroutine should use the following signature: IEnumerator MoveBetween(Vector3 pos1, Vector3 pos2){}(iv) Write a general-purpose version of your Coroutine which: [2] Moves the game object between each position in a List rather than just two positions. After arriving at each position, waits for the time defined in the Float, before continuing to the next Vector3 in the List. Your Coroutine should use the following signature: IEnumerator MoveBetween(List positions, float waitTime){}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!