Skip to content

Commit

Permalink
add LoadPathAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
ousttrue committed Sep 8, 2022
1 parent b3a0cb3 commit 3d13037
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 3d13037

Please sign in to comment.