Closed chelder86 closed 8 years ago
Hi. This is not expected to work because our SDK requires code running on the phone to read the sensors and compute the orientation, and of course there is no code running on the phone when you are using Unity Remote.
In the following link somebody shared a piece of code. The head tracking is working in his Iphone 5 with that code he said. Not working in my Samsung s4 though: http://answers.unity3d.com/answers/1092005/view.html
The very simple mode is just change the value of the field UseUnityRemoteInput: Find the field UseUnityRemoteInput on the GvrViewer.cs class and change the value to True.
But, If you want something more polite, you cam transform UseUnityRemoteInput into a property, create a private field useUnityRemoteInput and in the GvrViewerEditor.cs, into OnInspectorGUI, add the UseUnityRemoteInput property for dislplay into IDE.
GvrViewer.cs
Before:
public bool UseUnityRemoteInput = false;
After:
/// Use unity remote as the input source.
public bool UseUnityRemoteInput {
get
{
return useUnityRemoteInput;
}
set
{
if (value != useUnityRemoteInput)
{
useUnityRemoteInput = value;
if (device != null)
{
device.UpdateScreenData();
}
}
}
}
[SerializeField]
private bool useUnityRemoteInput = false;
GvrViewerEditor.cs
Before:
GUIContent editorSettingsLabel = new GUIContent("Unity Editor Emulation Settings",
"Controls for the in-editor emulation of a Cardboard viewer.");
After:
GUIContent editorSettingsLabel = new GUIContent("Unity Editor Emulation Settings",
"Controls for the in-editor emulation of a Cardboard viewer.");
GUIContent UseUnityRemoteInputLabel = new GUIContent("Use unity remote as the input.",
"When you can use Unity Remote Gyro");
And on the OnInspectorGUI method:
Before:
EditorGUILayout.LabelField(editorSettingsLabel, headingStyle);
gvrViewer.autoUntiltHead =
EditorGUILayout.Toggle(autoUntiltHeadLabel, gvrViewer.autoUntiltHead);
After:
EditorGUILayout.LabelField(editorSettingsLabel, headingStyle);
gvrViewer.autoUntiltHead =
EditorGUILayout.Toggle(autoUntiltHeadLabel, gvrViewer.autoUntiltHead);
gvrViewer.UseUnityRemoteInput =
EditorGUILayout.Toggle(UseUnityRemoteInputLabel, gvrViewer.UseUnityRemoteInput);
The result:
Finally a solution that works! Thanks a ton
Soooooooo Nice!!!! fpaganini
Tnx fpaganini ! this really solve this issue.
GvrViewer.cs and other file doesn't exist anymore in the new versions of Google VR SDK for Unity... How can be fixed this problem on the new versions...?
I'm on Windows 7 executing Unity 5.3.0f4. I have a Samsung s4 with Cyanogenmod.
I can see the same within the Unity Editor and my Android smartphone. However, if I move the phone, the image is still. I have to move it using the Unity editor.
Should it work? If not, are you planning to add compatibility with this tool?