object and gameobject

More
6 years 6 months ago #2517 by gontz
object and gameobject was created by gontz
Hello,
What is the difference between Object and GameObject ?
How do I use the gameObject?
I tried to add the localization script to the parent (Page1)
and I was expecting the script to activate and dezactivate the relevant gameObjects (children of the Page1 and referenced in localization)

It only shows me on screen the name of the objects
Please advise

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

More
6 years 6 months ago #2518 by gontz
Replied by gontz on topic object and gameobject
Is there a way to activate and deactivate objects based on the language selection ?

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

More
6 years 6 months ago #2519 by Frank
Replied by Frank on topic object and gameobject
Hi,
The GameObject type is meant to load prefabs dynamically.
The example scene 'I2Localization Standard Components' has an example of loading different prefabs (Cube, Sphere, Cylinder) depending on the language. Which is normally what you want to avoid having lots of disabled objects that are not using in the current language.

Said that, I like to add another Term Type to allow toggling childs depending on the language. Please vote for that and I will prioritize it:
trello.com/c/l3TPWMgM/15-new-term-type-child-visibility

In the mean time, you can do this by using the callbacks. Just create the following script and attach it to your Localize object:
using UnityEngine;

namespace I2.Loc
{

	public class MyChildToggle : MonoBehaviour 
	{
		public void OnModifyLocalization()
		{
			if (string.IsNullOrEmpty(Localize.MainTranslation))
				return;
			
			var tr = Localize.CurrentLocalizeComponent.GetComponent<Transform> ();

			// Find child with the name set in the Translation
			var child = tr.Find (Localize.MainTranslation);

			// if the child is found, change the active state
			if (child != null) 
			{
				// disable all childs except the found one
				foreach (Transform obj in tr)
					obj.gameObject.SetActive (obj == tr);
			}
		}
	}
}

You just need to set the callback in the Localize component as explained here and then type the name of the corresponding child in each translation.
inter-illusion.com/assets/I2LocalizationManual/Callbacks.html

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
6 years 6 months ago #2520 by gontz
Replied by gontz on topic object and gameobject
the example does not work or at least the prefab part. it shows for all 3 languages the same prefab...

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

More
6 years 6 months ago #2523 by Frank
Replied by Frank on topic object and gameobject
You are totally right!
It seems that with the latest changes to separate the Localization Targets implementation, the Prefab target got broken.

I fixed it now, and just to make it better, also added a new target to handle visibility of children!!
Let me test this a bit more today and will upload a new version to the beta folder!

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
6 years 5 months ago - 6 years 5 months ago #2524 by Frank
Replied by Frank on topic object and gameobject
I just uploaded v2.8.1a1 to the beta folder.

That version fixes the GameObject Term's type that was not doing any spawning, and also adds a new term type "Child". This type, enables the child object with the name matching the one in the translations.




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
Attachments:
Last edit: 6 years 5 months ago by Frank.
The following user(s) said Thank You: gontz

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

Time to create page: 0.440 seconds
Template by JoomlaShine