-
Notifications
You must be signed in to change notification settings - Fork 6
VGO runtime loading
IzayoiJiichan edited this page Sep 16, 2023
·
14 revisions
Load LoadScene
when using the UniVGO sample project.
Select the RuntimeLoader
game object in Hierarchy
,
In Inspector
, enter the full path of the VGO file you want to load at runtime in Local File Path
.
Press the play
button to run the game.
Confirm that the VGO file is loaded.
If an error has occurred, the Console will display the details of the error.
If you write your own script, write as follows.
using System;
using UnityEngine;
using UniVgo2;
public class VgoRuntimeLoader : MonoBehaviour
{
[SerializeField]
private string _FilePath = string.Empty;
private readonly VgoImporter _VgoImporter = new();
private VgoModelAsset? _VgoModelAsset = null;
private void Start()
{
VgoModelAsset vgoModelAsset = _VgoImporter.Load(_FilePath);
//_VgoImporter.ReflectSkybox(Camera.main, vgoModelAsset);
vgoModelAsset.ReflectSkybox(Camera.main);
_VgoModelAsset = vgoModelAsset;
}
// When using stream (FileStream, MemoryStream, etc...)
//private async Task Start()
//{
// using var vgoStream = new FileStream(_FilePath, FileMode.Open, FileAccess.Read);
//
// _VgoModelAsset = await _VgoImporter.LoadAsync(vgoStream, cancellationToken);
//
// vgoStream.Dispose();
//}
private void OnDestroy()
{
_VgoModelAsset?.Dispose();
}
}
- System Requirements
- Requirement Packages
- Install
- Other information
- Basic matters
- Create VGO
- VGO export
- VGO import
- VGO runtime loading