浏览代码

Merge pull request #54 from unity/bugs

Bug fixes
/4.0
GitHub Enterprise 5 年前
当前提交
bf8a6434
共有 4 个文件被更改,包括 82 次插入72 次删除
  1. 9
      Assets/Scenes/ARFoundationMenu/Menu.unity
  2. 67
      Assets/Scripts/UX/ARSceneSelectUI.cs
  3. 7
      Assets/Scripts/UX/BackButton.cs
  4. 71
      Assets/Scripts/UX/CheckAvailableFeatures.cs

9
Assets/Scenes/ARFoundationMenu/Menu.unity


- component: {fileID: 340560480}
- component: {fileID: 340560483}
m_Layer: 5
m_Name: CameraImage
m_Name: CpuImages
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 774532498}
m_TargetAssemblyTypeName:
m_MethodName: CameraImageButtonPressed
m_MethodName: CpuImagesButtonPressed
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}

m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Camera Image
m_Text: CPU Images
--- !u!222 &356847840
CanvasRenderer:
m_ObjectHideFlags: 0

m_ImageTracking: {fileID: 1311724826}
m_Anchors: {fileID: 1905833466}
m_ARWorldMap: {fileID: 1817576787}
m_CameraImage: {fileID: 340560480}
m_CpuImages: {fileID: 340560480}
m_EnvironmentProbes: {fileID: 1761617832}
m_ARCollaborationData: {fileID: 1385680569}
m_ARKitCoachingOverlay: {fileID: 1091803571}

67
Assets/Scripts/UX/ARSceneSelectUI.cs


using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using UnityEngine.XR.ARFoundation;
public class ARSceneSelectUI : MonoBehaviour
{

}
}
static void LoadScene(string sceneName)
{
LoaderUtility.Initialize();
SceneManager.LoadScene(sceneName, LoadSceneMode.Single);
}
SceneManager.LoadScene("SimpleAR", LoadSceneMode.Single);
LoadScene("SimpleAR");
SceneManager.LoadScene("ImageTracking", LoadSceneMode.Single);
LoadScene("ImageTracking");
SceneManager.LoadScene("Anchors", LoadSceneMode.Single);
LoadScene("Anchors");
SceneManager.LoadScene("ARCollaborationDataExample", LoadSceneMode.Single);
LoadScene("ARCollaborationDataExample");
SceneManager.LoadScene("ARKitCoachingOverlay", LoadSceneMode.Single);
LoadScene("ARKitCoachingOverlay");
SceneManager.LoadScene("ARWorldMap", LoadSceneMode.Single);
LoadScene("ARWorldMap");
public void CameraImageButtonPressed()
public void CpuImagesButtonPressed()
SceneManager.LoadScene("CameraImage", LoadSceneMode.Single);
LoadScene("CpuImages");
SceneManager.LoadScene("Check Support", LoadSceneMode.Single);
LoadScene("Check Support");
SceneManager.LoadScene("EnvironmentProbes", LoadSceneMode.Single);
LoadScene("EnvironmentProbes");
SceneManager.LoadScene("ObjectTracking", LoadSceneMode.Single);
LoadScene("ObjectTracking");
SceneManager.LoadScene("PlaneOcclusion", LoadSceneMode.Single);
LoadScene("PlaneOcclusion");
SceneManager.LoadScene("AllPointCloudPoints", LoadSceneMode.Single);
LoadScene("AllPointCloudPoints");
SceneManager.LoadScene("Scale", LoadSceneMode.Single);
LoadScene("Scale");
SceneManager.LoadScene("SampleUXScene", LoadSceneMode.Single);
LoadScene("SampleUXScene");
}
public void FaceTrackingMenuButtonPressed()

}
public void ARCoreFaceRegionsButtonPressed()
{
SceneManager.LoadScene("ARCoreFaceRegions", LoadSceneMode.Single);
LoadScene("ARCoreFaceRegions");
SceneManager.LoadScene("ARKitFaceBlendShapes", LoadSceneMode.Single);
LoadScene("ARKitFaceBlendShapes");
SceneManager.LoadScene("EyeLasers", LoadSceneMode.Single);
LoadScene("EyeLasers");
SceneManager.LoadScene("EyePoses", LoadSceneMode.Single);
LoadScene("EyePoses");
SceneManager.LoadScene("FaceMesh", LoadSceneMode.Single);
LoadScene("FaceMesh");
SceneManager.LoadScene("FacePose", LoadSceneMode.Single);
LoadScene("FacePose");
SceneManager.LoadScene("FixationPoint", LoadSceneMode.Single);
LoadScene("FixationPoint");
SceneManager.LoadScene("WorldCameraWithUserFacingFaceTracking", LoadSceneMode.Single);
LoadScene("WorldCameraWithUserFacingFaceTracking");
}
public void HumanSegmentationMenuButtonPressed()

}
public void HumanSegmentation2DButtonPressed()
{
SceneManager.LoadScene("HumanBodyTracking2D", LoadSceneMode.Single);
LoadScene("HumanBodyTracking2D");
SceneManager.LoadScene("HumanBodyTracking3D", LoadSceneMode.Single);
LoadScene("HumanBodyTracking3D");
SceneManager.LoadScene("HumanSegmentationImages", LoadSceneMode.Single);
LoadScene("HumanSegmentationImages");
SceneManager.LoadScene("LightEstimation", LoadSceneMode.Single);
LoadScene("LightEstimation");
}
public void PlaneDetectionMenuButtonPressed()

}
public void FeatheredPlanesButtonPressed()
{
SceneManager.LoadScene("FeatheredPlanes", LoadSceneMode.Single);
LoadScene("FeatheredPlanes");
SceneManager.LoadScene("PlaneClassification", LoadSceneMode.Single);
LoadScene("PlaneClassification");
SceneManager.LoadScene("TogglePlaneDetection", LoadSceneMode.Single);
LoadScene("TogglePlaneDetection");
}

7
Assets/Scripts/UX/BackButton.cs


using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.XR.ARFoundation;
using UnityEngine.XR.Management;
public class BackButton : MonoBehaviour
{

get { return m_BackButton; }
set { m_BackButton = value; }
}
void Start()
{
if (Application.CanStreamedLevelBeLoaded("Menu"))

}
public void BackButtonPressed()
{
{
LoaderUtility.Deinitialize();
}
}

71
Assets/Scripts/UX/CheckAvailableFeatures.cs


using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

get { return m_ARWorldMap; }
set { m_ARWorldMap = value; }
}
Button m_CameraImage;
public Button cameraImage
Button m_CpuImages;
public Button cpuImages
get { return m_CameraImage; }
set { m_CameraImage = value; }
get { return m_CpuImages; }
set { m_CpuImages = value; }
}
[SerializeField]

get { return m_FaceTracking; }
set { m_FaceTracking = value; }
}
[SerializeField]
Button m_FaceBlendShapes;
public Button faceBlendShapes

set { m_PlaneClassification = value; }
}
// Start is called before the first frame update
List<XRPlaneSubsystemDescriptor> planeDescriptors = new List<XRPlaneSubsystemDescriptor>();
var planeDescriptors = new List<XRPlaneSubsystemDescriptor>();
List<XRRaycastSubsystemDescriptor> rayCastDescriptors = new List<XRRaycastSubsystemDescriptor>();
var rayCastDescriptors = new List<XRRaycastSubsystemDescriptor>();
List<XRFaceSubsystemDescriptor> faceDescriptors = new List<XRFaceSubsystemDescriptor>();
var faceDescriptors = new List<XRFaceSubsystemDescriptor>();
List<XRImageTrackingSubsystemDescriptor> imageDescriptors = new List<XRImageTrackingSubsystemDescriptor>();
var imageDescriptors = new List<XRImageTrackingSubsystemDescriptor>();
List<XREnvironmentProbeSubsystemDescriptor> envDescriptors = new List<XREnvironmentProbeSubsystemDescriptor>();
var envDescriptors = new List<XREnvironmentProbeSubsystemDescriptor>();
List<XRAnchorSubsystemDescriptor> anchorDescriptors = new List<XRAnchorSubsystemDescriptor>();
var anchorDescriptors = new List<XRAnchorSubsystemDescriptor>();
List<XRObjectTrackingSubsystemDescriptor> objectDescriptors = new List<XRObjectTrackingSubsystemDescriptor>();
var objectDescriptors = new List<XRObjectTrackingSubsystemDescriptor>();
List<XRParticipantSubsystemDescriptor> participantDescriptors = new List<XRParticipantSubsystemDescriptor>();
var participantDescriptors = new List<XRParticipantSubsystemDescriptor>();
List<XRDepthSubsystemDescriptor> depthDescriptors = new List<XRDepthSubsystemDescriptor>();
var depthDescriptors = new List<XRDepthSubsystemDescriptor>();
List<XROcclusionSubsystemDescriptor> occlusionDescriptors = new List<XROcclusionSubsystemDescriptor>();
var occlusionDescriptors = new List<XROcclusionSubsystemDescriptor>();
List<XRCameraSubsystemDescriptor> cameraDescriptors = new List<XRCameraSubsystemDescriptor>();
var cameraDescriptors = new List<XRCameraSubsystemDescriptor>();
List<XRSessionSubsystemDescriptor> sessionDescriptors = new List<XRSessionSubsystemDescriptor>();
var sessionDescriptors = new List<XRSessionSubsystemDescriptor>();
SubsystemManager.GetSubsystemDescriptors<XRSessionSubsystemDescriptor>(sessionDescriptors);
if(planeDescriptors.Count > 0 && rayCastDescriptors.Count > 0)

}
}
if(faceDescriptors.Count > 0)
{
m_FaceTracking.interactable = true;

}
}
foreach(XROcclusionSubsystemDescriptor occlusionDescriptor in occlusionDescriptors)
foreach(var occlusionDescriptor in occlusionDescriptors)
{
if(occlusionDescriptor.supportsHumanSegmentationDepthImage && occlusionDescriptor.supportsHumanSegmentationStencilImage)
{

}
}
if((cameraDescriptor.supportsAverageBrightness || cameraDescriptor.supportsAverageIntensityInLumens) &&
cameraDescriptor.supportsAverageColorTemperature && cameraDescriptor.supportsCameraConfigurations &&
if((cameraDescriptor.supportsAverageBrightness || cameraDescriptor.supportsAverageIntensityInLumens) &&
cameraDescriptor.supportsAverageColorTemperature && cameraDescriptor.supportsCameraConfigurations &&
if(envDescriptors.Count > 0)
{
m_EnvironmentProbes.interactable = true;

{
m_PlaneDetection.interactable = true;
foreach(var planeDescriptor in planeDescriptors)
foreach(var planeDescriptor in planeDescriptors)
{
if(planeDescriptor.supportsClassification)
{

}
}
if(cameraDescriptors.Count > 0)
{
foreach(var cameraDescriptor in cameraDescriptors)

m_CameraImage.interactable = true;
m_CpuImages.interactable = true;
}
}
#if UNITY_IOS
if(sessionDescriptors.Count > 0 && ARKitSessionSubsystem.worldMapSupported)
{

if(sessionDescriptors.Count > 0 && ARKitSessionSubsystem.coachingOverlaySupported)
{
m_ARKitCoachingOverlay.interactable = true;
}
}
#endif
if(depthDescriptors.Count > 0)

if(planeDescriptors.Count > 0)
{
m_PlaneOcclusion.interactable = true;
}
}
}
正在加载...
取消
保存