Enable IResLoader Subclass

MyLocalization needs to load resources or transform resource paths in both Unity Editor mode and game runtime mode, so the IResLoader subclass needs to be assigned to MyLocalization at two points:

C# code needs to be assigned immediately after compiling

The game needs to be assigned as soon as it starts

C # code is compiled, calls the add UnityEditor. Callbacks. DidReloadScripts label method. For example, the AutoAssign method in the ResourceLoader:

#if UNITY_EDITOR && Using_ResourceLoader
    [UnityEditor.Callbacks.DidReloadScripts(200)]
    public static void AutoAssign() {
        LocalizationSetting.loader = new ResourceLoader();
    }
#endifc

Use this code to add similar code to the subnon-static classes that the user implements the IResLoader interface.

Game has just started, in a certain immediately executes the MonoBehaviour class Awake method to LocalizationSetting. Loader = new XXXLoader (); (Refer to the Demo ReLoaderSetter.cs class writing and use also line)

(Adjust the code order if necessary, moving the assigned classes closer to the top.)

Last updated