|
I'm attempting to create a StringTableMgr class that will load and keep track of string tables, but since it has to be globally accessible, I'm looking at this: http://forum.unity3d.com/threads/35617-TextManager-Localization-Script to see how to create a script that can be globally accessed without having to have an instance in each game object. My problem is that when I do it in the same way as the article I get a "You are not allowed to call Internal_CreateGameObject when declaring a variable" error.
I get the error on the line at the top where I create the GameObject. If I leave the creation code, and reference the 'm_StringTableMgr' var directly, I get an null reference exception on the 'foreach' statement in LoadStringTable, which could be either the StringTableMgr var or the 'm_StringTableList' I don't know what I'm doing wrong, since I'm fairly certain if this code were to run, it would work, since by calling GetInstance() in the Awake() function, I'm basically assuring the creation of the StringTableMgr object and it's data structures. Can anyone see anything that I've missed, or think of something that I should know but don't?
(comments are locked)
|
|
Since you're creating this in script anyway, just remove the ": MonoBehaviour" from the class -- make it a regular class, not a component. Okay, that's fixed part of it, but I'm loading a text asset using Resources.Load and then using a StringReader to parse the text from it, and it's giving me a "You are not allowed to call get_text when declaring a variable". Is there some problem using Resources.Load from outside of a Unity script?
May 01 '11 at 11:01 AM
Naim
Sounds like a new issue -- maybe ask it as a new question, and include some of your code? Resources.Load should be callable from anywhere.
May 02 '11 at 05:04 AM
yoyo
(comments are locked)
|
