vpenades / SharpGLTF

glTF reader and writer for .NET Standard
MIT License
476 stars 75 forks source link

Throws exception if BIN file is not present #157

Open gotoarchi opened 1 year ago

gotoarchi commented 1 year ago

Hi! This line will throw an exception if the bin file is not present.

https://github.com/vpenades/SharpGLTF/blob/66a90e9b56a5e0a05f474f5de13465819ca6679d/src/SharpGLTF.Core/Schema2/Serialization.ReadContext.cs#L63

Is there a method to check if the dependent files are present before we load the gltf file so that we can handle it?

vpenades commented 1 year ago

You have this method:

ModelRoot.GetSatellitePaths(string modelPath);

Which returns the paths to all the resource files used by the model. That includes .Bin files and texture files.

You can call this method to gather the paths and check whether the files exist or not before proceeding to load the model