Target "None" not available

4 years 11 months ago #210 by grit
Dear Inter-illusion team,

I am happy and thankful for your great loca plugin. I am using it effectively in my app to localize sprites, sounds and text labels.
At one point I am not sure, if I am using it in the most proper way, and encountered a problem there:
I am using movie files for cutscenes in my app and I also have to localize them as well. I load the movies as textures on planes via script using another plugin (LiveTexture by prime[31]). I added a i2 Localize component to my object, (which manages the movie and some other things in my scene) with a text term specifying the name of my movie to load (see attached pic). In my script I access this string like that:

videoName = I2.Loc.ScriptLocalization.Get(GetComponent.<I2.Loc.Localize>().Term);

This works well as long as my object doesn't have an Audio Source component – the target of the Localize component is just "None" then.
As soon as I add an Audio Source to my object, the target of the Localize component automatically changes to "AudioSource". I think this shouldn't happen as long as the term type is not "Audio Clip" (but text in my case). Furthermore I cannot switch the target back to "None", because it is not available in the drop menu, see attached picture. That is why, my audio is "localized", well does not work any more, because obviously the name of the movie file does not apply to the audio – and should not even dare to try.

Do you have any suggestion how I can stop the Localize component to connect itself to my audio source (or anything) or how I should handle this in another way?

Thank you in advance and kind regards,

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

4 years 11 months ago #218 by Frank
Replied by Frank on topic Target "None" not available
As you say, as soon as you add a valid target to an object containing a Localize component, it will assume that target is the one that has to be localized.
You could change how that is set, but there may be easier ways to go around that issue :-)

If you are changing the videoname by code, then instead of having a Localize component to ask for the term, you could just store the term string in your script.

Or you could add an empty child to that object to store the Localize component.
So you could execute later:
Transform LocGO = transform.FindChild("Loc");
videoName = I2.Loc.ScriptLocalization.Get( LocGO.GetComponent.<I2.Loc.Localize>().Term );

Or you could add a second Localize component to the object and disable it. So that even when it uses the audioSource as a target, it will not try to change its AudioClip. And you can querry that disabled component for its term as you do in your code.

The final way you can do, is by changing he I2 code it self.
Finding the target is done by the FindTarget() method in the Localize component.
You could add a boolean to the component class to mark which components shoudn't try finding a Target and skipping the code inside that function.
Something along the lines of:
public bool DisableTargetFinding = false;

		public bool FindTarget()
			// This is the new part------
			if (DisableTargetFinding)
				return false;
			// ---------------------------------

			if (EventFindTarget==null)

			return HasTargetCache();

Those are the ways I can think around your problem. Please let me know if you need further help making that work.

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.

4 years 11 months ago #223 by grit
Replied by grit on topic Target "None" not available
Thank you very much, this helps a lot.
I chose the solution of disabling the Localize component.

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

Time to create page: 1.069 seconds
Template by JoomlaShine