hey folks - i’m a bit confused at the deprecation of the ‘audio’ keyword in the API these days in Unity 5.0.1. so instead of something simple like:
audio.Play();
we now have
GetComponent.<AudioSource>().Play();
so what i’d like to do is have one line that assigns an AudioSource variable to a keyword like ‘footstep’, so i can call footstep.Play();
but i cannot get the nomenclature right in a single line. i can of course create a variable and then assign in Start() but i’m teaching non-programmer students and would like the line count to be as minimal as possible. what’s the new method to do this, or are you stuck having to declare it and then assign it separately?
separate question, but still similar - is ‘gameObject’ (the local instance of a GameObject referred to by a script) still functioning or has that been removed as well?
i’d prefer the C# based approach as i want to teach my students from C# examples and not UnityScript any longer.
any assistance appreciated!