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 bfacaff

Browse files
GVR SDK for Unity v1.130.0
1 parent 35d8ff5 commit bfacaff

36 files changed

+139
-50
lines changed

‎.github/ISSUE_TEMPLATE.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ Workarounds:
1616

1717

1818
Additional comments:
19+

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ namespace GoogleVR.Demos
2121
using UnityEditor.Build;
2222
using UnityEditorInternal.VR;
2323

24+
#if UNITY_2018_1_OR_NEWER
25+
using UnityEditor.Build.Reporting;
26+
#endif
27+
2428
class PermissionsDemoBuildProcessor : IPreprocessBuild, IPostprocessBuild
2529
{
2630
private const string SCENE_NAME_PERMISSIONS_DEMO = "PermissionsDemo";
@@ -32,6 +36,13 @@ public int callbackOrder
3236
get { return 0; }
3337
}
3438

39+
#if UNITY_2018_1_OR_NEWER
40+
public void OnPreprocessBuild(BuildReport report)
41+
{
42+
OnPreprocessBuild(report.summary.platform, report.summary.outputPath);
43+
}
44+
#endif
45+
3546
// OnPreprocessBuild() is called right before the build process begins. If it
3647
// detects that the first enabled scene in the build arrays is the PermissionsDemo,
3748
// and Daydream is in the VR SDKs, it will add Cardboard to the VR SDKs. Because
@@ -103,6 +114,13 @@ public void OnPreprocessBuild(BuildTarget target, string path)
103114
m_cardboardAddedFromCode = true;
104115
}
105116

117+
#if UNITY_2018_1_OR_NEWER
118+
public void OnPostprocessBuild(BuildReport report)
119+
{
120+
OnPostprocessBuild(report.summary.platform, report.summary.outputPath);
121+
}
122+
#endif
123+
106124
// OnPostprocessBuild() is called after the build process. It does appropriate cleanup
107125
// so that this script only affects build process for PermissionsDemo, not others.
108126
public void OnPostprocessBuild(BuildTarget target, string path)

‎Assets/GoogleVR/Demos/Scripts/HelloVR/ObjectController.cs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ namespace GoogleVR.HelloVR {
1818
[RequireComponent(typeof(Collider))]
1919
public class ObjectController : MonoBehaviour {
2020
private Vector3 startingPosition;
21-
private Renderer renderer;
21+
private Renderer myRenderer;
2222

2323
public Material inactiveMaterial;
2424
public Material gazedAtMaterial;
2525

2626
void Start() {
2727
startingPosition = transform.localPosition;
28-
renderer = GetComponent<Renderer>();
28+
myRenderer = GetComponent<Renderer>();
2929
SetGazedAt(false);
3030
}
3131

3232
public void SetGazedAt(bool gazedAt) {
3333
if (inactiveMaterial != null && gazedAtMaterial != null) {
34-
renderer.material = gazedAt ? gazedAtMaterial : inactiveMaterial;
34+
myRenderer.material = gazedAt ? gazedAtMaterial : inactiveMaterial;
3535
return;
3636
}
3737
}

‎Assets/GoogleVR/Editor/GvrBuildProcessor.cs‎

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
using UnityEngine;
1818
using UnityEditor;
1919
using UnityEditor.Build;
20+
using UnityEditor.iOS.Xcode;
21+
using System.IO;
2022
using System.Linq;
2123

2224
#if UNITY_2017_2_OR_NEWER
@@ -25,8 +27,12 @@
2527
using XRSettings = UnityEngine.VR.VRSettings;
2628
#endif // UNITY_2017_2_OR_NEWER
2729

30+
#if UNITY_2018_1_OR_NEWER
31+
using UnityEditor.Build.Reporting;
32+
#endif
33+
2834
// Notifies users if they build for Android or iOS without Cardboard or Daydream enabled.
29-
class GvrBuildProcessor : IPreprocessBuild {
35+
class GvrBuildProcessor : IPreprocessBuild,IPostprocessBuild {
3036
private const string VR_SETTINGS_NOT_ENABLED_ERROR_MESSAGE_FORMAT =
3137
"To use the Google VR SDK on {0}, 'Player Settings > Virtual Reality Supported' setting must be checked.\n" +
3238
"Please fix this setting and rebuild your app.";
@@ -41,6 +47,13 @@ public int callbackOrder {
4147
get { return 0; }
4248
}
4349

50+
#if UNITY_2018_1_OR_NEWER
51+
public void OnPreprocessBuild(BuildReport report)
52+
{
53+
OnPreprocessBuild(report.summary.platform, report.summary.outputPath);
54+
}
55+
#endif
56+
4457
public void OnPreprocessBuild (BuildTarget target, string path)
4558
{
4659
if (target != BuildTarget.Android && target != BuildTarget.iOS) {
@@ -70,6 +83,29 @@ public void OnPreprocessBuild (BuildTarget target, string path)
7083
}
7184
}
7285

86+
#if UNITY_2018_1_OR_NEWER
87+
public void OnPostprocessBuild(BuildReport report) {
88+
OnPostprocessBuild(report.summary.platform, report.summary.outputPath);
89+
}
90+
#endif
91+
92+
public void OnPostprocessBuild(BuildTarget target, string outputPath) {
93+
// Add Camera usage description for scanning viewer QR codes on iOS.
94+
if (target == BuildTarget.iOS) {
95+
// Read plist
96+
var plistPath = Path.Combine(outputPath, "Info.plist");
97+
var plist = new PlistDocument();
98+
plist.ReadFromFile(plistPath);
99+
100+
// Update value
101+
PlistElementDict rootDict = plist.root;
102+
rootDict.SetString("NSCameraUsageDescription", "Scan Cardboard viewer QR code");
103+
104+
// Write plist
105+
File.WriteAllText(plistPath, plist.WriteToString());
106+
}
107+
}
108+
73109
// 'Player Settings > Virtual Reality Supported' enabled?
74110
private bool IsVRSupportEnabled() {
75111
return PlayerSettings.virtualRealitySupported;
0 Bytes
Binary file not shown.
66 Bytes
Binary file not shown.
-1.11 MB
Binary file not shown.

‎Assets/GoogleVR/Plugins/Android/gvr-keyboard.aar.meta‎

Lines changed: 23 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
35 Bytes
Binary file not shown.
41 Bytes
Binary file not shown.

0 commit comments

Comments
(0)

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