Hi, thanks for the courses! I was wondering what was the difference between the two following methods used at the beginning of this lecture in order to change the properties of Unity objects through scripts:
-
Using a SerializeField variable of the correct type and then setting this variable to the desired object in Unity.
-
Using a variable of the correct type and then setting its value to be the desired object with FindObjectOfType in C#.
In the Quiz script, Gary uses the first method to access the TimerImage and the second method to access the Timer. I tried using FindObjectOfType() to access TimerImage in my script but it didnāt work, why? Is the image only a component of TimerImage ?
I also tried to use the first method rather than the second one to access my Timer but this time it worked. Is there a particular reason not to do so?