Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0d04c13

Browse files
GVR SDK for Unity v1.110.0
1 parent 95d9451 commit 0d04c13

File tree

216 files changed

+1797
-36713
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+1797
-36713
lines changed

‎Assets/GoogleVR/Demos/Editor/DemoInputManagerEditor.cs‎

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,48 +12,50 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
using UnityEngine;
16-
using UnityEditor;
17-
18-
[CustomEditor(typeof(DemoInputManager))]
19-
public class DemoInputManagerEditor : Editor {
20-
SerializedProperty emulatedPlatformTypeProp;
21-
SerializedProperty gvrControllerMainProp;
22-
SerializedProperty gvrControllerPointerProp;
23-
SerializedProperty gvrReticlePointerProp;
24-
25-
void OnEnable () {
26-
gvrControllerMainProp =
27-
serializedObject.FindProperty(DemoInputManager.CONTROLLER_MAIN_PROP_NAME);
28-
gvrControllerPointerProp =
29-
serializedObject.FindProperty(DemoInputManager.CONTROLLER_POINTER_PROP_NAME);
30-
gvrReticlePointerProp =
31-
serializedObject.FindProperty(DemoInputManager.RETICLE_POINTER_PROP_NAME);
32-
33-
emulatedPlatformTypeProp =
34-
serializedObject.FindProperty(DemoInputManager.EMULATED_PLATFORM_PROP_NAME);
35-
}
15+
namespace GoogleVR.Demos {
16+
using UnityEngine;
17+
using UnityEditor;
18+
19+
[CustomEditor(typeof(DemoInputManager))]
20+
public class DemoInputManagerEditor : Editor {
21+
SerializedProperty emulatedPlatformTypeProp;
22+
SerializedProperty gvrControllerMainProp;
23+
SerializedProperty gvrControllerPointerProp;
24+
SerializedProperty gvrReticlePointerProp;
25+
26+
void OnEnable () {
27+
gvrControllerMainProp =
28+
serializedObject.FindProperty(DemoInputManager.CONTROLLER_MAIN_PROP_NAME);
29+
gvrControllerPointerProp =
30+
serializedObject.FindProperty(DemoInputManager.CONTROLLER_POINTER_PROP_NAME);
31+
gvrReticlePointerProp =
32+
serializedObject.FindProperty(DemoInputManager.RETICLE_POINTER_PROP_NAME);
33+
34+
emulatedPlatformTypeProp =
35+
serializedObject.FindProperty(DemoInputManager.EMULATED_PLATFORM_PROP_NAME);
36+
}
3637

37-
public override void OnInspectorGUI() {
38-
serializedObject.Update();
38+
public override void OnInspectorGUI() {
39+
serializedObject.Update();
3940

40-
// Add clickable script field, as would have been provided by DrawDefaultInspector()
41-
MonoScript script = MonoScript.FromMonoBehaviour (target as MonoBehaviour);
42-
EditorGUI.BeginDisabledGroup (true);
43-
EditorGUILayout.ObjectField ("Script", script, typeof(MonoScript), false);
44-
EditorGUI.EndDisabledGroup ();
41+
// Add clickable script field, as would have been provided by DrawDefaultInspector()
42+
MonoScript script = MonoScript.FromMonoBehaviour (target as MonoBehaviour);
43+
EditorGUI.BeginDisabledGroup (true);
44+
EditorGUILayout.ObjectField ("Script", script, typeof(MonoScript), false);
45+
EditorGUI.EndDisabledGroup ();
4546

46-
EditorGUILayout.PropertyField(gvrControllerMainProp);
47-
EditorGUILayout.PropertyField(gvrControllerPointerProp);
48-
EditorGUILayout.PropertyField(gvrReticlePointerProp);
47+
EditorGUILayout.PropertyField(gvrControllerMainProp);
48+
EditorGUILayout.PropertyField(gvrControllerPointerProp);
49+
EditorGUILayout.PropertyField(gvrReticlePointerProp);
4950

50-
if (DemoInputManager.playerSettingsHasCardboard() ==
51-
DemoInputManager.playerSettingsHasDaydream()) {
52-
// Show the platform emulation dropdown only if both or neither VR SDK selected in
53-
// Player Settings > Virtual Reality supported,
54-
EditorGUILayout.PropertyField(emulatedPlatformTypeProp);
55-
}
51+
if (DemoInputManager.playerSettingsHasCardboard() ==
52+
DemoInputManager.playerSettingsHasDaydream()) {
53+
// Show the platform emulation dropdown only if both or neither VR SDK selected in
54+
// Player Settings > Virtual Reality supported,
55+
EditorGUILayout.PropertyField(emulatedPlatformTypeProp);
56+
}
5657

57-
serializedObject.ApplyModifiedProperties();
58+
serializedObject.ApplyModifiedProperties();
59+
}
5860
}
5961
}

‎Assets/GoogleVR/Demos/Editor/PermissionsDemoBuildProcessor.cs‎

Lines changed: 88 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -14,125 +14,125 @@
1414

1515
// Only invoke custom build processor when building for Android.
1616
#if UNITY_ANDROID
17-
using System;
18-
using UnityEditor;
19-
using UnityEditor.Build;
20-
using UnityEngine;
21-
using UnityEditorInternal.VR;
22-
23-
class PermissionsDemoBuildProcessor : IPreprocessBuild, IPostprocessBuild
17+
namespace GoogleVR.Demos
2418
{
25-
private const string SCENE_NAME_PERMISSIONS_DEMO = "PermissionsDemo";
26-
private const string VR_DEVICE_CARDBOARD = "cardboard";
27-
private const string VR_DEVICE_DAYDREAM = "daydream";
28-
29-
private bool m_cardboardAddedFromCode = false;
30-
31-
public int callbackOrder
32-
{
33-
get { return 0; }
34-
}
19+
using System;
20+
using UnityEditor;
21+
using UnityEditor.Build;
22+
using UnityEditorInternal.VR;
3523

36-
// OnPreprocessBuild() is called right before the build process begins. If it
37-
// detects that the first enabled scene in the build arrays is the PermissionsDemo,
38-
// and Daydream is in the VR SDKs, it will add Cardboard to the VR SDKs. Because
39-
// the PermissionsDemo needs a perm statement in the Manifest while other demos don't.
40-
// Adding Cardboard to VR SDKs will merge in the Manifest-Cardboard which has perm
41-
// statement in it.
42-
public void OnPreprocessBuild(BuildTarget target, string path)
24+
class PermissionsDemoBuildProcessor : IPreprocessBuild, IPostprocessBuild
4325
{
44-
m_cardboardAddedFromCode=false;
26+
privateconststringSCENE_NAME_PERMISSIONS_DEMO="PermissionsDemo";
4527

46-
string[]androidVrSDKs=VREditor.GetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Android);
28+
privateboolm_cardboardAddedFromCode=false;
4729

48-
EditorBuildSettingsScene[] scenes = EditorBuildSettings.scenes;
30+
public int callbackOrder
31+
{
32+
get { return 0; }
33+
}
4934

50-
// See if PermissionsDemo is the first enabled scene in the array of scenes to build.
51-
for (int i = 0; i < scenes.Length; i++)
35+
// OnPreprocessBuild() is called right before the build process begins. If it
36+
// detects that the first enabled scene in the build arrays is the PermissionsDemo,
37+
// and Daydream is in the VR SDKs, it will add Cardboard to the VR SDKs. Because
38+
// the PermissionsDemo needs a perm statement in the Manifest while other demos don't.
39+
// Adding Cardboard to VR SDKs will merge in the Manifest-Cardboard which has perm
40+
// statement in it.
41+
public void OnPreprocessBuild(BuildTarget target, string path)
5242
{
53-
if (scenes[i].path.Contains(SCENE_NAME_PERMISSIONS_DEMO))
43+
m_cardboardAddedFromCode = false;
44+
45+
string[] androidVrSDKs = VREditor.GetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Android);
46+
47+
EditorBuildSettingsScene[] scenes = EditorBuildSettings.scenes;
48+
49+
// See if PermissionsDemo is the first enabled scene in the array of scenes to build.
50+
for (int i = 0; i < scenes.Length; i++)
5451
{
55-
if (!scenes[i].enabled)
52+
if (scenes[i].path.Contains(SCENE_NAME_PERMISSIONS_DEMO))
5653
{
57-
return;
54+
if (!scenes[i].enabled)
55+
{
56+
return;
57+
}
58+
else
59+
{
60+
break;
61+
}
5862
}
5963
else
6064
{
61-
break;
65+
if (scenes[i].enabled)
66+
{
67+
return;
68+
}
6269
}
6370
}
64-
else
71+
72+
bool hasCardboard = Array.Exists<string>(androidVrSDKs,
73+
element => element.Equals(GvrSettings.VR_SDK_CARDBOARD));
74+
75+
if (hasCardboard)
6576
{
66-
if (scenes[i].enabled)
67-
{
68-
return;
69-
}
77+
return;
7078
}
71-
}
7279

73-
bool hasCardboard = Array.Exists<string>(androidVrSDKs,
74-
element => element.Equals(VR_DEVICE_CARDBOARD));
80+
bool hasDaydream = Array.Exists<string>(androidVrSDKs,
81+
element => element.Equals(GvrSettings.VR_SDK_DAYDREAM));
7582

76-
if (hasCardboard)
77-
{
78-
return;
79-
}
83+
if (!hasDaydream)
84+
{
85+
return;
86+
}
8087

81-
bool hasDaydream = Array.Exists<string>(androidVrSDKs,
82-
element => element.Equals(VR_DEVICE_DAYDREAM));
88+
string[] androidVrSDKsAppended = new string[androidVrSDKs.Length+1];
8389

84-
if(!hasDaydream)
85-
{
86-
return;
87-
}
90+
for(inti=0;i<androidVrSDKs.Length;i++)
91+
{
92+
androidVrSDKsAppended[i]=androidVrSDKs[i];
93+
}
8894

89-
string[]androidVrSDKsAppended=newstring[androidVrSDKs.Length+1];
95+
androidVrSDKsAppended[androidVrSDKsAppended.Length-1]=GvrSettings.VR_SDK_CARDBOARD;
9096

91-
for (int i = 0; i < androidVrSDKs.Length; i++)
92-
{
93-
androidVrSDKsAppended[i] = androidVrSDKs[i];
97+
VREditor.SetVREnabledOnTargetGroup(
98+
BuildTargetGroup.Android, true);
99+
VREditor.SetVREnabledDevicesOnTargetGroup(
100+
BuildTargetGroup.Android,
101+
androidVrSDKsAppended);
102+
103+
m_cardboardAddedFromCode = true;
94104
}
95105

96-
androidVrSDKsAppended[androidVrSDKsAppended.Length - 1] = VR_DEVICE_CARDBOARD;
106+
// OnPostprocessBuild() is called after the build process. It does appropriate cleanup
107+
// so that this script only affects build process for PermissionsDemo, not others.
108+
public void OnPostprocessBuild(BuildTarget target, string path)
109+
{
110+
if (!m_cardboardAddedFromCode)
111+
return;
97112

98-
VREditor.SetVREnabledOnTargetGroup(
99-
BuildTargetGroup.Android, true);
100-
VREditor.SetVREnabledDevicesOnTargetGroup(
101-
BuildTargetGroup.Android,
102-
androidVrSDKsAppended);
113+
string[] androidVrSDKs = VREditor.GetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Android);
103114

104-
m_cardboardAddedFromCode = true;
105-
}
106-
107-
// OnPostprocessBuild() is called after the build process. It does appropriate cleanup
108-
// so that this script only affects build process for PermissionsDemo, not others.
109-
public void OnPostprocessBuild(BuildTarget target, string path)
110-
{
111-
if (!m_cardboardAddedFromCode)
112-
return;
115+
// The enabled devices are modified somehow, which shouldn't happen. Abort the post build process.
116+
if (androidVrSDKs.Length == 0 || androidVrSDKs[androidVrSDKs.Length - 1] != GvrSettings.VR_SDK_CARDBOARD)
117+
{
118+
return;
119+
}
113120

114-
string[] androidVrSDKs = VREditor.GetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Android);
121+
string[] androidVrSDKsShortened = newstring[androidVrSDKs.Length-1];
115122

116-
// The enabled devices are modified somehow, which shouldn't happen. Abort the post build process.
117-
if (androidVrSDKs.Length == 0 || androidVrSDKs[androidVrSDKs.Length - 1] != VR_DEVICE_CARDBOARD)
118-
{
119-
return;
120-
}
123+
for (int i = 0; i < androidVrSDKsShortened.Length; i++)
124+
{
125+
androidVrSDKsShortened[i] = androidVrSDKs[i];
126+
}
121127

122-
string[] androidVrSDKsShortened = new string[androidVrSDKs.Length - 1];
128+
VREditor.SetVREnabledOnTargetGroup(
129+
BuildTargetGroup.Android, true);
130+
VREditor.SetVREnabledDevicesOnTargetGroup(
131+
BuildTargetGroup.Android,
132+
androidVrSDKsShortened);
123133

124-
for (int i = 0; i < androidVrSDKsShortened.Length; i++)
125-
{
126-
androidVrSDKsShortened[i] = androidVrSDKs[i];
134+
m_cardboardAddedFromCode = false;
127135
}
128-
129-
VREditor.SetVREnabledOnTargetGroup(
130-
BuildTargetGroup.Android, true);
131-
VREditor.SetVREnabledDevicesOnTargetGroup(
132-
BuildTargetGroup.Android,
133-
androidVrSDKsShortened);
134-
135-
m_cardboardAddedFromCode = false;
136136
}
137137
}
138138
#endif // UNITY_ANDROID

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /