Skip to content

Commit 0d2af3d

Browse files
Merge pull request #544 from Unity-Technologies/fix-player-errors
Fix errors in player builds related to serialization
2 parents 98e8ea8 + 7d1a661 commit 0d2af3d

12 files changed

Lines changed: 179 additions & 37 deletions

Scripts/Helpers/EditorWindowCapture.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#if UNITY_EDITOR
2-
using System;
1+
using System;
32
using System.Reflection;
43
using UnityEngine;
54
using Object = UnityEngine.Object;
@@ -10,6 +9,7 @@
109

1110
namespace UnityEditor.Experimental.EditorVR.Helpers
1211
{
12+
#if UNITY_EDITOR
1313
/// <summary>
1414
/// Captures a RenderTexture representing an Editor window
1515
/// </summary>
@@ -179,5 +179,9 @@ public void SendEvent(Transform rayOrigin, Transform workspace, EventType type)
179179
public static extern int SendMessage(IntPtr hWnd, int uMsg, int wParam, IntPtr lParam);
180180
#endif
181181
}
182-
}
182+
#else
183+
sealed class EditorWindowCapture : MonoBehaviour
184+
{
185+
}
183186
#endif
187+
}

Scripts/Helpers/EditorWindowCaptureUpdater.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#if UNITY_EDITOR
2-
using UnityEngine;
1+
using UnityEngine;
32
using UnityEngine.UI;
43
using UnityEditor.Experimental.EditorVR.Utilities;
54

65
namespace UnityEditor.Experimental.EditorVR.Helpers
76
{
7+
#if UNITY_EDITOR
88
/// <summary>
99
/// Updates a RawImage texture with data from an EditorWindowCapture
1010
/// </summary>
@@ -88,5 +88,20 @@ void LateUpdate()
8888
}
8989
}
9090
}
91-
}
91+
#else
92+
sealed class EditorWindowCaptureUpdater : MonoBehaviour
93+
{
94+
[SerializeField]
95+
EditorWindowCapture m_EditorWindowCapture;
96+
97+
[SerializeField]
98+
RawImage m_RawImage;
99+
100+
[SerializeField]
101+
Material m_Material;
102+
103+
[SerializeField]
104+
bool m_LockAspect;
105+
}
92106
#endif
107+
}

Scripts/Helpers/VRSmoothCamera.cs

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#if UNITY_EDITOR
2-
using System.Collections.Generic;
1+
using System.Collections.Generic;
32
using UnityEditor.Experimental.EditorVR.Core;
43
using UnityEngine;
54

65
namespace UnityEditor.Experimental.EditorVR.Helpers
76
{
7+
#if UNITY_EDITOR
88
/// <summary>
99
/// A preview camera that provides for smoothing of the position and look vector
1010
/// </summary>
@@ -23,7 +23,8 @@ sealed class VRSmoothCamera : MonoBehaviour, IPreviewCamera
2323
[SerializeField]
2424
int m_TargetDisplay;
2525

26-
[SerializeField, Range(1, 180)]
26+
[Range(1, 180)]
27+
[SerializeField]
2728
int m_FieldOfView = 40;
2829

2930
[SerializeField]
@@ -141,5 +142,25 @@ void LateUpdate()
141142
}
142143
}
143144
}
144-
}
145+
#else
146+
sealed class VRSmoothCamera : MonoBehaviour
147+
{
148+
#pragma warning disable 649
149+
[SerializeField]
150+
Camera m_VRCamera;
151+
152+
[SerializeField]
153+
int m_TargetDisplay;
154+
155+
[SerializeField]
156+
int m_FieldOfView = 40;
157+
158+
[SerializeField]
159+
float m_PullBackDistance = 0.8f;
160+
161+
[SerializeField]
162+
float m_SmoothingMultiplier = 3;
163+
#pragma warning restore 649
164+
}
145165
#endif
166+
}

Scripts/Modules/HierarchyModule.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#if UNITY_EDITOR
2-
using System;
1+
using System;
32
using System.Collections.Generic;
43
using System.Linq;
54
using UnityEditor.Experimental.EditorVR.Core;
65
using UnityEngine;
76

87
namespace UnityEditor.Experimental.EditorVR.Modules
98
{
9+
#if UNITY_EDITOR
1010
sealed class HierarchyModule : MonoBehaviour, ISystemModule, ISelectionChanged
1111
{
1212
readonly List<IUsesHierarchyData> m_HierarchyLists = new List<IUsesHierarchyData>();
@@ -260,5 +260,9 @@ static void InstanceIDToComponentTypes(int instanceID, HashSet<string> types, Ha
260260
}
261261
}
262262
}
263-
}
263+
#else
264+
sealed class HierarchyModule : MonoBehaviour
265+
{
266+
}
264267
#endif
268+
}

Scripts/Modules/ProjectFolderModule.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#if UNITY_EDITOR
21
using System;
32
using System.Collections;
43
using System.Collections.Generic;
@@ -9,6 +8,7 @@
98

109
namespace UnityEditor.Experimental.EditorVR.Modules
1110
{
11+
#if UNITY_EDITOR
1212
sealed class ProjectFolderModule : MonoBehaviour, ISystemModule
1313
{
1414
// Maximum time (in ms) before yielding in CreateFolderData: should be target frame time
@@ -188,5 +188,9 @@ static AssetData CreateAssetData(HierarchyProperty hp, HashSet<string> assetType
188188
return new AssetData(hp.name, hp.guid, typeName);
189189
}
190190
}
191-
}
191+
#else
192+
sealed class ProjectFolderModule : MonoBehaviour
193+
{
194+
}
192195
#endif
196+
}

Workspaces/Common/Scripts/EditorWindowWorkspace.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#if UNITY_EDITOR
2-
using UnityEditor.Experimental.EditorVR.Handles;
1+
using UnityEditor.Experimental.EditorVR.Handles;
32
using UnityEditor.Experimental.EditorVR.Helpers;
43
using UnityEngine;
54

65
namespace UnityEditor.Experimental.EditorVR.Workspaces
76
{
7+
#if UNITY_EDITOR
88
abstract class EditorWindowWorkspace : Workspace
99
{
1010
#pragma warning disable 649
@@ -67,5 +67,11 @@ void OnDragEnded(BaseHandle handle, HandleEventData eventData)
6767
m_Capture.SendEvent(eventData.rayOrigin, transform, EventType.MouseUp);
6868
}
6969
}
70-
}
70+
#else
71+
abstract class EditorWindowWorkspace : Workspace
72+
{
73+
[SerializeField]
74+
GameObject m_CaptureWindowPrefab;
75+
}
7176
#endif
77+
}

Workspaces/ConsoleWorkspace/ConsoleWorkspace.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
#if UNITY_EDITOR
2-
namespace UnityEditor.Experimental.EditorVR.Workspaces
1+
namespace UnityEditor.Experimental.EditorVR.Workspaces
32
{
3+
#if UNITY_EDITOR
44
[MainMenuItem("Console", "Workspaces", "View errors, warnings and other messages")]
55
[SpatialMenuItem("Console", "Workspaces", "View errors, warnings and other messages")]
6+
#else
7+
[EditorOnlyWorkspace]
8+
#endif
69
sealed class ConsoleWorkspace : EditorWindowWorkspace
710
{
811
}
912
}
10-
#endif

Workspaces/InspectorWorkspace/InspectorWorkspace.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#if UNITY_EDITOR
21
using System.Collections.Generic;
32
using UnityEditor.Experimental.EditorVR.Data;
43
using UnityEditor.Experimental.EditorVR.Handles;
@@ -7,11 +6,10 @@
76

87
namespace UnityEditor.Experimental.EditorVR.Workspaces
98
{
9+
#if UNITY_EDITOR
1010
[MainMenuItem("Inspector", "Workspaces", "View and edit GameObject properties")]
1111
sealed class InspectorWorkspace : Workspace, ISelectionChanged, IInspectorWorkspace
1212
{
13-
public new static readonly Vector3 DefaultBounds = new Vector3(0.3f, 0.1f, 0.5f);
14-
1513
#pragma warning disable 649
1614
[SerializeField]
1715
GameObject m_ContentPrefab;
@@ -391,5 +389,15 @@ public void UpdateInspector(GameObject obj, bool fullRebuild = false)
391389
UpdateCurrentObject(fullRebuild);
392390
}
393391
}
394-
}
392+
#else
393+
[EditorOnlyWorkspace]
394+
sealed class InspectorWorkspace : Workspace
395+
{
396+
[SerializeField]
397+
GameObject m_ContentPrefab;
398+
399+
[SerializeField]
400+
GameObject m_LockPrefab;
401+
}
395402
#endif
403+
}

Workspaces/InspectorWorkspace/Scripts/InspectorListViewController.cs

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#if UNITY_EDITOR
2-
using ListView;
1+
using ListView;
32
using System;
43
using System.Collections.Generic;
54
using UnityEditor.Experimental.EditorVR.Data;
@@ -8,6 +7,7 @@
87

98
namespace UnityEditor.Experimental.EditorVR.Workspaces
109
{
10+
#if UNITY_EDITOR
1111
sealed class InspectorListViewController : NestedListViewController<InspectorData, InspectorListItem, int>, IUsesGameObjectLocking, IUsesStencilRef
1212
{
1313
const string k_MaterialStencilRef = "_StencilRef";
@@ -311,5 +311,35 @@ void OnDestroy()
311311
ObjectUtils.Destroy(m_NoClipHighlightMaskMaterial);
312312
}
313313
}
314-
}
314+
#else
315+
sealed class InspectorListViewController : NestedListViewController<InspectorData, InspectorListItem, int>
316+
{
317+
[SerializeField]
318+
Material m_RowCubeMaterial;
319+
320+
[SerializeField]
321+
Material m_BackingCubeMaterial;
322+
323+
[SerializeField]
324+
Material m_UIMaterial;
325+
326+
[SerializeField]
327+
Material m_UIMaskMaterial;
328+
329+
[SerializeField]
330+
Material m_NoClipBackingCubeMaterial;
331+
332+
[SerializeField]
333+
Material m_HighlightMaterial;
334+
335+
[SerializeField]
336+
Material m_HighlightMaskMaterial;
337+
338+
[SerializeField]
339+
Material m_NoClipHighlightMaterial;
340+
341+
[SerializeField]
342+
Material m_NoClipHighlightMaskMaterial;
343+
}
315344
#endif
345+
}

Workspaces/InspectorWorkspace/Scripts/InspectorUI.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
#if UNITY_EDITOR
2-
using UnityEngine;
1+
using UnityEngine;
32
using UnityEditor.Experimental.EditorVR.Handles;
43

54
namespace UnityEditor.Experimental.EditorVR.Workspaces
65
{
6+
#if UNITY_EDITOR
77
sealed class InspectorUI : MonoBehaviour
88
{
99
#pragma warning disable 649
@@ -32,5 +32,17 @@ public InspectorListViewController listView
3232
get { return m_ListView; }
3333
}
3434
}
35-
}
35+
#else
36+
sealed class InspectorUI : MonoBehaviour
37+
{
38+
[SerializeField]
39+
InspectorListViewController m_ListView;
40+
41+
[SerializeField]
42+
LinearHandle m_ScrollHandle;
43+
44+
[SerializeField]
45+
RectTransform m_ListPanel;
46+
}
3647
#endif
48+
}

0 commit comments

Comments
 (0)