Skip to content

Commit

Permalink
Merge pull request #1782 from ousttrue/fix/SimpleViewer_null
Browse files Browse the repository at this point in the history
add LoadPathAsync
  • Loading branch information
ousttrue authored Sep 8, 2022
2 parents b3a0cb3 + 3d13037 commit faa1dcf
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Assets/VRM_Samples/SimpleViewer/ViewerUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ private void Start()
string[] cmds = System.Environment.GetCommandLineArgs();
if (cmds.Length > 1)
{
LoadModelAsync(cmds[1]);
LoadPathAsync(cmds[1]);
}

m_texts.Start();
Expand Down Expand Up @@ -391,10 +391,20 @@ void OnOpenClicked()
return;
}

LoadModelAsync(path);
LoadPathAsync(path);
}

async void LoadModelAsync(string path, byte[] bytes = null)
async void LoadPathAsync(string path)
{
if (!File.Exists(path))
{
Debug.LogWarning($"{path} not exists");
return;
}
LoadModelAsync(path, File.ReadAllBytes(path));
}

async void LoadModelAsync(string path, byte[] bytes)
{
var size = bytes != null ? bytes.Length : 0;
Debug.Log($"LoadModelAsync: {path}: {size}bytes");
Expand Down

0 comments on commit faa1dcf

Please sign in to comment.