Skip to content

Commit d017099

Browse files
authored
fix: runtime build errors (#53)
* Fix error/warnings when building runtime * Wrap editor code inside UNITY_EDITOR * Update project settings * Updating package version to 0.0.4-preview * Update changelog
1 parent c31a7bf commit d017099

File tree

11 files changed

+148
-90
lines changed

11 files changed

+148
-90
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [0.0.4-preview] - 2020-04-03
4+
* fix: runtime build errors
5+
* fix: avoid tests from modifying the project assets
6+
37
## [0.0.3-preview] - 2020-03-27
48
* fix: update DLLs to avoid the requirement of installing VCRUNTIME140_1.DLL
59
* docs: Add Japanese docs

Editor/BGJobCacheChecker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public BGJobCacheChecker( BGJobCacheParam param )
1414
{
1515
m_param = param;
1616
UpdateManager.QueueBackGroundTask(this);
17-
UpdateManager.m_ResetDelegate += Reset;
17+
UpdateManager.m_resetDelegate += Reset;
1818
}
1919
public override void Execute()
2020
{

Runtime/PlayableAssets/StreamingImageSequence/StreamingImageSequencePlayableAsset.cs

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ public StreamingImageSequencePlayableAsset() {
9090
Reset();
9191
}
9292

93+
//----------------------------------------------------------------------------------------------------------------------
94+
/// <summary>
95+
/// Get the source folder
96+
/// </summary>
97+
/// <returns>The folder where the images are located</returns>
98+
public string GetFolder() { return m_folder; }
99+
93100
//----------------------------------------------------------------------------------------------------------------------
94101
private double LocalTimeToCurveTime(double localTime) {
95102
AnimationCurve curve = GetAndValidateAnimationCurve();
@@ -157,16 +164,8 @@ internal string GetImagePath(int index) {
157164
internal bool HasImages() {
158165
return (!string.IsNullOrEmpty(m_folder) && null != m_imagePaths && m_imagePaths.Count > 0);
159166
}
160-
161-
//----------------------------------------------------------------------------------------------------------------------
162-
/// <summary>
163-
/// Get the source folder
164-
/// </summary>
165-
/// <returns>The folder where the images are located</returns>
166-
public string GetFolder() { return m_folder; }
167-
168-
internal UnityEditor.DefaultAsset GetTimelineDefaultAsset() { return m_timelineDefaultAsset; }
169-
167+
168+
170169
//----------------------------------------------------------------------------------------------------------------------
171170
internal void Reset() {
172171
m_loadingIndex = -1;
@@ -209,26 +208,7 @@ internal bool Verified
209208
return m_verified;
210209
}
211210
}
212-
213-
//----------------------------------------------------------------------------------------------------------------------
214-
215-
216-
internal void SetParam(StreamingImageSequencePlayableAssetParam param) {
217-
if (m_resolution.Width > 0 && m_resolution.Height > 0) {
218-
m_resolution = param.Resolution;
219-
m_dimensionRatio = m_resolution.CalculateRatio();
220-
}
221-
m_imagePaths = param.Pictures;
222-
m_folder = param.Folder;
223-
if (null!=m_folder && m_folder.StartsWith("Assets")) {
224-
m_timelineDefaultAsset = AssetDatabase.LoadAssetAtPath<UnityEditor.DefaultAsset>(m_folder);
225-
} else {
226-
m_timelineDefaultAsset = null;
227-
}
228-
m_texture = null;
229-
EditorUtility.SetDirty(this);
230-
}
231-
211+
232212
//---------------------------------------------------------------------------------------------------------------------
233213

234214
#region PlayableAsset functions override
@@ -524,10 +504,37 @@ private void RefreshAnimationCurveInTimelineClip(AnimationCurve curve) {
524504
}
525505

526506

507+
//----------------------------------------------------------------------------------------------------------------------
508+
509+
#region Unity Editor code
510+
511+
#if UNITY_EDITOR
512+
internal void SetParam(StreamingImageSequencePlayableAssetParam param) {
513+
if (m_resolution.Width > 0 && m_resolution.Height > 0) {
514+
m_resolution = param.Resolution;
515+
m_dimensionRatio = m_resolution.CalculateRatio();
516+
}
517+
m_imagePaths = param.Pictures;
518+
m_folder = param.Folder;
519+
if (null!=m_folder && m_folder.StartsWith("Assets")) {
520+
m_timelineDefaultAsset = AssetDatabase.LoadAssetAtPath<UnityEditor.DefaultAsset>(m_folder);
521+
} else {
522+
m_timelineDefaultAsset = null;
523+
}
524+
m_texture = null;
525+
EditorUtility.SetDirty(this);
526+
}
527+
528+
internal UnityEditor.DefaultAsset GetTimelineDefaultAsset() { return m_timelineDefaultAsset; }
529+
530+
#endif
531+
532+
#endregion
533+
527534
//----------------------------------------------------------------------------------------------------------------------
528535

529-
[SerializeField] private string m_folder;
530-
[SerializeField] List<string> m_imagePaths;
536+
[SerializeField] private string m_folder = null;
537+
[SerializeField] List<string> m_imagePaths = null;
531538

532539
//The ground truth for using/dropping an image in a particular frame. See the notes below
533540
[SerializeField] List<PlayableFrame> m_playableFrames = null;

Runtime/PlayableAssets/StreamingImageSequence/StreamingImageSequencePlayableMixer.cs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,25 @@ public StreamingImageSequencePlayableMixer() {
3232
m_loadStartOffsetTime = -1.0;
3333
}
3434

35+
36+
//----------------------------------------------------------------------------------------------------------------------
37+
38+
#region IPlayableBehaviour interfaces
3539
public override void OnPlayableCreate(Playable playable)
3640
{
37-
UpdateManager.m_ResetDelegate += Reset;
41+
#if UNITY_EDITOR
42+
UpdateManager.m_resetDelegate += Reset;
43+
#endif
3844
}
3945

4046
public override void OnPlayableDestroy(Playable playable)
4147
{
42-
UpdateManager.m_ResetDelegate -= Reset;
48+
#if UNITY_EDITOR
49+
UpdateManager.m_resetDelegate -= Reset;
50+
#endif
4351
}
4452

4553

46-
void Reset()
47-
{
48-
m_loadStartOffsetTime = -1.0;
49-
m_spriteRenderer = null;
50-
m_image = null;
51-
m_meshRenderer = null;
52-
}
5354

5455
//----------------------------------------------------------------------------------------------------------------------
5556
public override void OnGraphStart(Playable playable){
@@ -134,6 +135,7 @@ public override void ProcessFrame(Playable playable, FrameData info, object play
134135

135136
}
136137

138+
#endregion
137139
//----------------------------------------------------------------------------------------------------------------------
138140

139141
private void ProcessInAdvanceLoading(double time, TimelineClip clip, int index)
@@ -187,6 +189,14 @@ protected override void ProcessActiveClipV(StreamingImageSequencePlayableAsset a
187189

188190
}
189191

192+
//----------------------------------------------------------------------------------------------------------------------
193+
194+
void Reset() {
195+
m_loadStartOffsetTime = -1.0;
196+
m_spriteRenderer = null;
197+
m_image = null;
198+
m_meshRenderer = null;
199+
}
190200
//---------------------------------------------------------------------------------------------------------------------
191201

192202
protected override void InitInternalV(GameObject boundGameObject) {

Runtime/UpdateManager.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ public enum JobOrder
4747
private static Dictionary<PlayableDirector, PlayableDirectorStatus> s_directorStatusDictiornary = new Dictionary<PlayableDirector, PlayableDirectorStatus>();
4848
private static string s_AppDataPath;
4949
private static string s_StreamingAssetPath;
50-
public static event SetupBeforePlay m_SetupBeforePlayingDelegete = null;
51-
public static event SetupAfterPlay m_SetupAfterPlayingDelegete = null;
52-
public static event ResetDelegate m_ResetDelegate = null;
50+
#if UNITY_EDITOR
51+
public static event SetupBeforePlay m_setupBeforePlayingDelegate = null;
52+
public static event SetupAfterPlay m_setupAfterPlayingDelegate = null;
53+
public static event ResetDelegate m_resetDelegate = null;
54+
#endif
5355
private static JobOrder[] s_orders = new JobOrder[] {
5456
JobOrder.Top,
5557
JobOrder.AboveNormal,
@@ -108,7 +110,7 @@ static internal void InitInRuntime()
108110
#if !UNITY_EDITOR
109111
UpdateManager.GetStreamingAssetPath(); // must be executed in main thread.
110112
Assert.IsTrue(m_bInitialized == false);
111-
Util.Log("InitInRuntime()");
113+
LogUtility.LogDebug("InitInRuntime()");
112114
StartThread();
113115
foreach (var order in s_orders)
114116
{
@@ -159,24 +161,24 @@ static void ChangedPlayModeState(PlayModeStateChange state)
159161

160162
static void CallResetDelegate()
161163
{
162-
if (m_ResetDelegate != null)
164+
if (m_resetDelegate != null)
163165
{
164-
m_ResetDelegate();
166+
m_resetDelegate();
165167
}
166168
}
167169
static void CallSetupBeforePlayingDelegate()
168170
{
169-
if (m_SetupBeforePlayingDelegete!= null)
171+
if (m_setupBeforePlayingDelegate!= null)
170172
{
171-
m_SetupBeforePlayingDelegete();
173+
m_setupBeforePlayingDelegate();
172174
}
173175
}
174176

175177
static void CallSetupAfterPlayDelegate()
176178
{
177-
if (m_SetupAfterPlayingDelegete != null)
179+
if (m_setupAfterPlayingDelegate != null)
178180
{
179-
m_SetupAfterPlayingDelegete();
181+
m_setupAfterPlayingDelegate();
180182
}
181183
}
182184
static void UpdateFromEditor()

StreamingImageSequence~/Packages/com.unity.streaming-image-sequence/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"displayName": "Streaming Image Sequence",
33
"name": "com.unity.streaming-image-sequence",
44
"unity": "2019.2",
5-
"version": "0.0.2-preview",
5+
"version": "0.0.4-preview",
66
"dependencies": {},
7-
"description": "Streaming Image Sequence Proxy is a plug-in for Unity Timeline to use sequential pictures without making Unity 2D Sprites",
7+
"description": "Streaming Image Sequence is a package for playing sequential image sequences in Unity Timeline easily without making Unity 2D Sprites.",
88
"author": "Unity Technology Japan",
99
"contributors": [
1010
"Toshiyuki Mori <[email protected]> (https://github.com/higeometry)",

StreamingImageSequence~/ProjectSettings/EditorBuildSettings.asset

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ EditorBuildSettings:
55
m_ObjectHideFlags: 0
66
serializedVersion: 2
77
m_Scenes:
8+
- enabled: 0
9+
path:
10+
guid: 00000000000000000000000000000000
811
- enabled: 1
9-
path: Assets/Scenes/SampleScene.unity
10-
guid: 99c9720ab356a0642a771bea13969a05
12+
path: Assets/Scenes/ShortScene/ShortScene.unity
13+
guid: 5710e68f38ccdde4484ea04b38aa5823
1114
m_configObjects: {}

StreamingImageSequence~/ProjectSettings/GraphicsSettings.asset

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
--- !u!30 &1
44
GraphicsSettings:
55
m_ObjectHideFlags: 0
6-
serializedVersion: 12
6+
serializedVersion: 13
77
m_Deferred:
88
m_Mode: 1
99
m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0}
@@ -35,6 +35,10 @@ GraphicsSettings:
3535
- {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0}
3636
- {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
3737
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
38+
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
39+
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
40+
- {fileID: 16002, guid: 0000000000000000f000000000000000, type: 0}
41+
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
3842
m_PreloadedShaders: []
3943
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
4044
type: 0}
@@ -59,3 +63,5 @@ GraphicsSettings:
5963
m_AlbedoSwatchInfos: []
6064
m_LightsUseLinearIntensity: 0
6165
m_LightsUseColorTemperature: 0
66+
m_LogWhenShaderIsCompiled: 0
67+
m_AllowEnlightenSupportForUpgradedProject: 1

0 commit comments

Comments
 (0)