LWFObject.SetLoader C# (CSharp) Method

SetLoader() public static method

public static SetLoader ( Func,System lwfDataLoader = null, UnityEngine.Texture2D>.System.Func textureLoader = null, System.Action textureUnloader = null ) : void
lwfDataLoader Func,System
textureLoader UnityEngine.Texture2D>.System.Func
textureUnloader System.Action
return void
    public static void SetLoader(LWFDataLoader lwfDataLoader = null,
		TextureLoader textureLoader = null,
		TextureUnloader textureUnloader = null)
    {
        ResourceCache cache = ResourceCache.SharedInstance();
        cache.SetLoader(lwfDataLoader, textureLoader, textureUnloader);
    }

Usage Example

Example #1
0
 private static void global_init()
 {
     if (!_globalInitialized)
     {
         LWFObject.SetLoader(
             lwfDataLoader: (name) => {
             TextAsset asset = Resources.Load(name) as TextAsset;
             if (asset == null)
             {
                 return(null);
             }
             return(asset.bytes);
         },
             textureLoader: (name) => {
             Texture2D texture = Resources.Load(name) as Texture2D;
             if (texture == null)
             {
                 return(null);
             }
             return(texture);
         }
             );
         _multColorId       = Shader.PropertyToID("_MultColor");
         _addColorId        = Shader.PropertyToID("_AddColor");
         _lerpColorId       = Shader.PropertyToID("_LerpColor");
         _globalInitialized = true;
     }
 }