Localize callback use new UnityEvent

More
9 years 1 month ago #1120 by yuewah
Localize callback is using SendMessage, can it be updated to use UnityEvent ( docs.unity3d.com/Manual/UnityEvents.html )

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

More
9 years 1 month ago #1122 by Frank
Hi,
I would also like to use UnityEvents too, but the plugin supports Unity 4.5 and they were introduced in Unity 4.6.

I'm evaluating moving the minimum required version to be 4.6 so that I could simplify a bit more the setup and use some of the new features, but I'm not sure how many developers are still using the plugin in 4.5. Been monitoring the Unity Stats and every day there are less developers using pre 4.6 versions, but still is like 4%.

Nonetheless, the current implementation of the callback, works similar to the UnityEvent, it allows you to select an object and a method within its scripts.

The benefits I see of using UnityEvent, will be that it will allow you to call several functions, even if the signature doesn't match, and that there is one less class in the project :-)
Am I missing any other advantage that you will like to get by moving into UnityEvents? Is it because of speed differences? Haven't compared performance yet on SendMessage vs UnityEvents, but if there is a substantial one, then that will be a very compelling reason to upgrade haha.

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 1 month ago #1123 by yuewah
By the way, EventCallback or UnityEvent can have inspector features, however, some developer like using code only, no target gameobject, no new function.

Term = "HELLO_WORLD"
MainTranslation = "Hello World {0}"

e.g.
var localize = this.gameObject.GetComponent<Localize>();
localize.EventOnLocalize = () => {
Localize.MainTranslation = string.Format(Localize.MainTranslation, 999 );
}
localize.SetTerm("HELLO_WORLD");

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

More
9 years 1 month ago #1124 by Frank
Been doing some test and I like the idea of switching into UnityEvents as it has been faster on my tests and have more features (hooking anonymous functions, multiple callbacks, etc).

I have to keep backward compatibility, so over the next few releases I will try adding code to transfer the callback values from the current system into the UnityEvents.
Will let you know as soon as this is added to the beta.

Thanks for the suggestion!
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 1 month ago - 9 years 1 month ago #1126 by yuewah
is it possible to have shortcut method that can do the following step ?

1. Add Localize Component if not exist
2. Add Localize callback (one time)
3. SetTerm
4. Passing object args for string.Format
Last edit: 9 years 1 month ago by yuewah.

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

Time to create page: 0.273 seconds
Template by JoomlaShine