[Issue] i2 seen get error in Unity 5.3.4

More
8 years 43 minutes ago - 8 years 11 minutes ago #1338 by JZ
Hi,

I just update Unity to 5.3.4, and i2 localization 2.6.5 a2 keep show error when i select 'Resource\I2Language"
(PC / Mac is all get error.)

Error:
InvalidOperationException: The following game object is invoking the DontDestroyOnLoad method: I2ResourceManager. Notice that DontDestroyOnLoad can only be used in play mode and, as such, cannot be part of an editor script.
I2.Loc.ResourceManager.get_pInstance () (at Assets/I2/Localization/Scripts/ResourceManager.cs:23)
I2.Loc.LocalizationManager.RegisterSourceInResources () (at Assets/I2/Localization/Scripts/LocalizationManager.cs:283)
I2.Loc.LocalizationManager.UpdateSources () (at Assets/I2/Localization/Scripts/LocalizationManager.cs:255)
I2.Loc.LocalizationEditor.OnEnable () (at Assets/I2/Localization/Scripts/Editor/Inspectors/LanguageSourceInspector.cs:59)

NullReferenceException: Object reference not set to an instance of an object
I2.Loc.LocalizationEditor.OnGUI_GoogleCredentials () (at Assets/I2/Localization/Scripts/Editor/Localization/LocalizationEditor_Spreadsheet_Google.cs:119)
I2.Loc.LocalizationEditor.OnGUI_Spreadsheet_Google () (at Assets/I2/Localization/Scripts/Editor/Localization/LocalizationEditor_Spreadsheet_Google.cs:38)
I2.Loc.LocalizationEditor.OnGUI_ImportExport () (at Assets/I2/Localization/Scripts/Editor/Localization/LocalizationEditor.cs:82)
I2.Loc.LocalizationEditor.OnGUI_Main () (at Assets/I2/Localization/Scripts/Editor/Localization/LocalizationEditor.cs:63)
I2.Loc.LocalizationEditor.OnInspectorGUI () (at Assets/I2/Localization/Scripts/Editor/Inspectors/LanguageSourceInspector.cs:134)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1231)
UnityEditor.DockArea:OnGUI()

GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced)

Please help
Thank you

JZ
Last edit: 8 years 11 minutes ago by JZ. Reason: add error console messages

Please Log in or Create an account to join the conversation.

More
7 years 11 months ago #1339 by Frank
Hi,
I just re-downloaded 2.6.5a2 for testing and installed unity 5.3.4 and got no errors.

By looking at the line numbers in the log you sent me, they seem a bit off (its reporting the DontDestroyOnLoad been in line 23 when is actually at line 26).
Can you please, delete the I2\Localization folder and download the latest version from the AssetStore or the beta folder?

In any case, the ResourceManager.cs get_pInstance function that is giving you problems should look like this:
		public static ResourceManager pInstance
		{
			get {
				bool changed = mInstance==null;

				if (mInstance==null)
					mInstance = (ResourceManager)Object.FindObjectOfType(typeof(ResourceManager));

				if (mInstance==null)
				{
					GameObject GO = new GameObject("I2ResourceManager", typeof(ResourceManager));
					GO.hideFlags = GO.hideFlags | HideFlags.HideAndDontSave;	// Only hide it if this manager was autocreated
					mInstance = GO.GetComponent<ResourceManager>();
				}

				if (changed && Application.isPlaying)
					DontDestroyOnLoad(mInstance.gameObject);

				return mInstance;
			}
		}
		static ResourceManager mInstance;

If after doing a clean install of the plugin, you still get the issues. Can you please let me know the steps you do to get the problems? (i.e. when selecting the I2Languages.prefab while playing?)

Hope that helps,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out

Please Log in or Create an account to join the conversation.

More
7 years 11 months ago #1340 by JZ
Hi Frank,

I replace your scripts and the issue is fixed! thank you.

follow is my local version for you ref.:
// public static ResourceManager pInstance
// {
// get {
// if (mInstance==null)
// mInstance = (ResourceManager)Object.FindObjectOfType(typeof(ResourceManager));
//
// if (mInstance==null)
// {
// GameObject GO = new GameObject("I2ResourceManager", typeof(ResourceManager));
// GO.hideFlags = GO.hideFlags | HideFlags.HideAndDontSave; // Only hide it if this manager was autocreated
// mInstance = GO.GetComponent<ResourceManager>();
// }
//
// DontDestroyOnLoad(mInstance.gameObject);
// return mInstance;
// }
// }
// static ResourceManager mInstance;

i think it's old version of ResourceManager.cs. (2.6.4 f3)
but my Asset Store still show me local is 2.6.5 a2.
So i have to delete the Asset Store's temporary file in 'C:\Users\xxx\AppData\Roaming\Unity\Asset Store-5.x'
and Asset Store is just can update to 2.6.5 a2 successfully.

Thank you again

JZ

Please Log in or Create an account to join the conversation.

Time to create page: 0.179 seconds
Template by JoomlaShine