Just a few notes from the battlefield that is my game for Fantoche:
Build Order Matters
Whenever you get the error message «The type or namespace name <type/namespace> could not be found (are you missing a using directive or an assembly reference?)» in Unity when trying to access a
component on another
GameObject, do not bother to rewrite your complete code.
Just check the folders your classes are in: If your referenced classes are somewhere in the top Assets folder while your referencing class is in the Standard Assets, you will have a problem, since scripts in Standard Assets are compiled first – and as such, compiled before the referenced classes even exist.
Reverse the placement or just put them all in one folder, and you are set.
Yield Instructions in C#
yield instructions in C# are a bit unwieldy. Most of all, they need a Coroutine that returns a
IEnumerator. To get this type in MonoDevelop, add
using System.Collections; to the top of your class.
Load Resources Dynamically
Assets residing in a folder called Resources (big surprise) can be loaded at runtime using
Resources.Load(). To get the assets as the right type, use
On Other News
The XMLStringReader has been rewritten to support path strings for audio files (residing, as you might have guessed, in the Resources folder). Also: a trigger script with which those strings can be accessed and the audio played.
More of that in a later post, though. My hair is dry enough to go to bed now.