2

So I have a class inside my unity project, during gameplay, some properties get assigned some values and stuff, is there is a way to save the whole class to be reloaded again later on ?

I use Microsoft.ML and apparently it's having a hard time loading stuff on android

var mlContext = new MLContext();

ITransformer mlModel = mlContext.Model.Load(MLNetModelPath, out var _);

inside my class I have this and I would like to run the project on my pc, save the mlModel components to use them later on android phones. Help please ?

  • So if I'm understanding correctly, you cannot call mlContext.Model.Load() on Android, but you are able to use the object returned by that call as desired? If so, you can serialize the object when you run the project on your PC and deserialize the model on Android. Have a look at your options here: https://learn.microsoft.com/en-us/dotnet/standard/serialization/ – Margaret Schrayer Aug 29 '22 at 18:31
  • @MargaretSchrayer Thanks for the reply. I have already tried to find a way to serialize fields of Microsoft.ML, but no can do, most of them are non-serializable or private.. – Alhussein Jamil Aug 31 '22 at 11:41

0 Answers0