I'm new to C# and Unity both, but trying to make use of design patterns I've seen elsewhere -- and so far, this seems like a very mature and capable environment. But I'm a bit stuck on one minor thing:
I have a static class that manages some item definitions for my game. There's no need to attach it to anything, as all the services it provides are global. All works fine when the definition data is hard-coded into the class, but now I'd prefer to define these in text files included in the project as text assets.
But now I'm stuck: if my script were a MonoBehavior, and instantiated as a component of some game object, I could give it a TextAsset property and assign the file through the inspector. But, being a static script, I don't see how that will work. I can think of a few hackish work-arounds, like attaching my TextAsset to some unrelated game object and finding it via GameObject.Find and GetComponent, but that doesn't seem very appetizing.
Is there some cleaner solution you would recommend?
asked Feb 23 '11 at 02:44 AM