Tanoda
ExternalDataMapperSample.cs
Go to the documentation of this file.
1using System;
2using System.IO;
4using TriLibCore.Utils;
5using UnityEngine;
6
7namespace TriLibCore.Samples
8{
12 public class ExternalDataMapperSample : ExternalDataMapper
13 {
24 public override Stream Map(AssetLoaderContext assetLoaderContext, string originalFilename, out string finalPath)
25 {
26 finalPath = $"{assetLoaderContext.BasePath}/{FileUtils.GetFilename(originalFilename)}";
27 if (File.Exists(finalPath))
28 {
29 Debug.Log($"Found external file at: {finalPath}");
30 return File.OpenRead(finalPath);
31 }
32
33 throw new Exception($"File {originalFilename} not found.");
34 }
35 }
36}
UnityEngine.Debug Debug
Definition: TanodaServer.cs:19
Represents a class that finds external resources at the given model base path.
override Stream Map(AssetLoaderContext assetLoaderContext, string originalFilename, out string finalPath)
Tries to find the given external data source using the original resource filename and the context par...