Allow targetless localize components?

More
9 years 5 months ago #835 by tacticsofttech
Hi,

I am using the Localize component to localize properties in other components.
The pattern is that we put a localize component on an object, and then a (custom) component that sends a UnityEvent whenever the localize call happens, then we register the target component's property as a listener.

The problem with this is that if this GameObject has a child, it is recognized as a "Prefab" target, which results in bad behavior (child objects are deleted when the term value is edited).

If the object doesn't have children, its target is set to "None" which is actually the behavior we are looking for in this case.
The problem is we can't select this mode ("None") if the prefab target is wrongfully identified.

How can I keep this "None" behavior while still allowing GameObjects with Localize components to have child objects?

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

More
9 years 5 months ago #836 by Frank
Hi,
I see your use case. I will add a new target type for automatic localizing variables/properties in a script. That should solve the issue and allow you to listen to the localization without the hack :-)

In the mean time, if you are not localizing using the Prefab target, you can comment out that target and it will not be used. (Will always be "None")

On the file Assets\I2\Localization\Scripts\Targets\LocalizeUnityStandard.cs

comment out line 22. It should look like:
		public void RegisterEvents_UnityStandard()
		{
			EventFindTarget += FindTarget_GUIText;
			EventFindTarget += FindTarget_TextMesh;
			EventFindTarget += FindTarget_AudioSource;
			EventFindTarget += FindTarget_GUITexture;
			// EventFindTarget += FindTarget_Child;
		}

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
9 years 5 months ago - 9 years 5 months ago #838 by tacticsofttech
Thanks, it enables my use case for the time being. Waiting for a new release :)
Last edit: 9 years 5 months ago by tacticsofttech.

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

Time to create page: 0.189 seconds
Template by JoomlaShine