/// <summary> /// Creates the AssetLoaderOptions instance and displays the Model file-picker. /// </summary> /// <remarks> /// You can create the AssetLoaderOptions by right clicking on the Assets Explorer and selecting "TriLib->Create->AssetLoaderOptions->Pre-Built AssetLoaderOptions". /// </remarks> public void LoadModel() { var assetLoaderOptions = AssetLoader.CreateDefaultLoaderOptions(); var assetLoaderFilePicker = AssetLoaderFilePicker.Create(); assetLoaderFilePicker.LoadModelFromFilePickerAsync("Select a Model file", OnLoad, OnMaterialsLoad, OnProgress, OnBeginLoad, OnError, null, assetLoaderOptions); }
/// <summary> /// Shows the file picker for loading a model from local file-system. /// </summary> protected void LoadModelFromFile(GameObject wrapperGameObject = null, Action <AssetLoaderContext> onMaterialsLoad = null) { SetLoading(false); var filePickerAssetLoader = AssetLoaderFilePicker.Create(); filePickerAssetLoader.LoadModelFromFilePickerAsync("Select a File", OnLoad, onMaterialsLoad ?? OnMaterialsLoad, OnProgress, OnBeginLoadModel, OnError, wrapperGameObject ?? gameObject, AssetLoaderOptions); }
/// <summary> /// Creates the AssetLoaderOptions instance and displays the Model file-picker. /// It also creates our custom UserPropertiesMapper (SampleUserPropertiesMapper) instance and passes a callback function to it. /// </summary> /// <remarks> /// You can create the AssetLoaderOptions by right clicking on the Assets Explorer and selecting "TriLib->Create->AssetLoaderOptions->Pre-Built AssetLoaderOptions". /// </remarks> public void LoadModel() { var assetLoaderOptions = AssetLoader.CreateDefaultLoaderOptions(); var userPropertiesMapper = ScriptableObject.CreateInstance <SampleUserPropertiesMapper>(); userPropertiesMapper.OnUserDataProcessed += OnUserDataProcessed; assetLoaderOptions.UserPropertiesMapper = userPropertiesMapper; var assetLoaderFilePicker = AssetLoaderFilePicker.Create(); assetLoaderFilePicker.LoadModelFromFilePickerAsync("Select a Model file", OnLoad, OnMaterialsLoad, OnProgress, OnBeginLoad, OnError, null, assetLoaderOptions); }