|
@@ -6,7 +6,7 @@ using TriLibCore.Utils;
|
|
|
using UnityEngine;
|
|
|
|
|
|
public class TriLibModelLoad
|
|
|
-{
|
|
|
+{
|
|
|
|
|
|
|
|
|
|
|
@@ -14,30 +14,30 @@ public class TriLibModelLoad
|
|
|
|
|
|
|
|
|
|
|
|
- public static void Load(string ModelURL, Action<AssetLoaderContext> OnLoad, Action<AssetLoaderContext> OnMaterialsLoad, Action<AssetLoaderContext, float> OnProgress, Action<IContextualizedError> OnError)
|
|
|
+ public static void Load(string ModelURL, Action<AssetLoaderContext> OnLoad, Action<AssetLoaderContext> OnMaterialsLoad, Action<AssetLoaderContext, float> OnProgress, Action<IContextualizedError> OnError, GameObject go = null)
|
|
|
{
|
|
|
- if(ModelURL.Contains("http"))
|
|
|
+ if (ModelURL.Contains("http"))
|
|
|
{
|
|
|
- loadUrl( ModelURL, OnLoad, OnMaterialsLoad, OnProgress, OnError);
|
|
|
+ loadUrl(ModelURL, OnLoad, OnMaterialsLoad, OnProgress, OnError, go);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- loadFile(ModelURL, OnLoad, OnMaterialsLoad, OnProgress, OnError);
|
|
|
+ loadFile(ModelURL, OnLoad, OnMaterialsLoad, OnProgress, OnError, go);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- static void loadUrl(string ModelURL, Action<AssetLoaderContext> OnLoad, Action<AssetLoaderContext> OnMaterialsLoad, Action<AssetLoaderContext, float> OnProgress, Action<IContextualizedError> OnError)
|
|
|
+ static void loadUrl(string ModelURL, Action<AssetLoaderContext> OnLoad, Action<AssetLoaderContext> OnMaterialsLoad, Action<AssetLoaderContext, float> OnProgress, Action<IContextualizedError> OnError, GameObject go = null)
|
|
|
{
|
|
|
var assetLoaderOptions = AssetLoader.CreateDefaultLoaderOptions();
|
|
|
var webRequest = AssetDownloader.CreateWebRequest(ModelURL);
|
|
|
- AssetDownloader.LoadModelFromUri(webRequest, OnLoad, OnMaterialsLoad, OnProgress, OnError, null, assetLoaderOptions);
|
|
|
+ AssetDownloader.LoadModelFromUri(webRequest, OnLoad, OnMaterialsLoad, OnProgress, OnError, go, assetLoaderOptions);
|
|
|
|
|
|
}
|
|
|
|
|
|
- static void loadFile(string ModelPath, Action<AssetLoaderContext> OnLoad, Action<AssetLoaderContext> OnMaterialsLoad, Action<AssetLoaderContext, float> OnProgress, Action<IContextualizedError> OnError)
|
|
|
+ static void loadFile(string ModelPath, Action<AssetLoaderContext> OnLoad, Action<AssetLoaderContext> OnMaterialsLoad, Action<AssetLoaderContext, float> OnProgress, Action<IContextualizedError> OnError, GameObject go = null)
|
|
|
{
|
|
|
var assetLoaderOptions = AssetLoader.CreateDefaultLoaderOptions();
|
|
|
- AssetLoader.LoadModelFromFile(ModelPath, OnLoad, OnMaterialsLoad, OnProgress, OnError, null, assetLoaderOptions);
|
|
|
+ AssetLoader.LoadModelFromFile(ModelPath, OnLoad, OnMaterialsLoad, OnProgress, OnError, go, assetLoaderOptions);
|
|
|
}
|
|
|
|
|
|
|