浏览代码

Only set the config dropdown once rather than every frame as ARKit does not change the current configuration immediately.

/1.5-preview
Tim Mowrer 6 年前
当前提交
505e6928
共有 1 个文件被更改,包括 11 次插入9 次删除
  1. 20
      Assets/Scripts/CameraConfigController.cs

20
Assets/Scripts/CameraConfigController.cs


void Awake()
{
m_Dropdown = GetComponent<Dropdown>();
m_Dropdown.ClearOptions();
void Update()
void PopulateDropdown()
m_Dropdown.ClearOptions();
var cameraSubsystem = ARSubsystemManager.cameraSubsystem;
if (cameraSubsystem == null)
return;

if (configurations.count == 0)
return;
// Here we demonstrate the two ways to enumerate the camera configurations.
// Typically, you would do this once, perhaps at the start of the AR app
// rather than every frame.
// There are two ways to enumerate the camera configurations.
// Here, we use a foreach to iterate over all the available configurations
m_ConfigurationNames.Clear();
// 1. Use a foreach to iterate over all the available configurations
// We can also use a normal for...loop
// 2. Use a normal for...loop
var currentConfig = cameraSubsystem.GetCurrentConfiguration();
for (int i = 0; i < configurations.count; i++)
{

}
}
void Update()
{
if (m_ConfigurationNames.Count == 0)
PopulateDropdown();
}
}
正在加载...
取消
保存