Skip to content

Commit f7e6489

Browse files
committed
fix the recorder related issues in mapDebug module
1 parent a885fc8 commit f7e6489

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

Runtime/Mapbox/MapDebug/MapboxDebug.asmdef

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"GUID:36ca6af6e2b304d4090888554d6ce199",
77
"GUID:73cdb7a2ce06b4867bd56dca984fb31b",
88
"GUID:5ff00896142b94bc7a58a7c72b2faf57",
9-
"GUID:2400806fb903448e5b7e737b92f1e434"
9+
"GUID:2400806fb903448e5b7e737b92f1e434",
10+
"GUID:847b179520b009e4c8d15c296b1cbf35"
1011
],
1112
"includePlatforms": [],
1213
"excludePlatforms": [],

Runtime/Mapbox/MapDebug/Scripts/Logging/LoggingMapBehaviour.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
using Mapbox.Example.Scripts.ModuleBehaviours;
99
using Mapbox.Example.Scripts.TileProviderBehaviours;
1010
using Mapbox.ImageModule.Terrain.TerrainStrategies;
11-
#if UNITY_RECORDER
11+
#if UNITY_RECORDER && UNITY_EDITOR
1212
using Mapbox.MapDebug.Sequence;
1313
#endif
1414
using Mapbox.UnityMapService;
@@ -33,7 +33,7 @@ public class LoggingMapBehaviour : MapBehaviourCore
3333
[SerializeField] protected TileProviderBehaviour TileProvider;
3434
public Action<MapService> MapServiceReady = (v) => { };
3535

36-
#if UNITY_RECORDER
36+
#if UNITY_RECORDER && UNITY_EDITOR
3737
private SequenceControllerBehaviour _infoSequence;
3838
#endif
3939
public virtual void Start()
@@ -46,7 +46,7 @@ public virtual void Start()
4646
public override void Initialize()
4747
{
4848
_mapLogger = FindObjectOfType<MapLogger>();
49-
#if UNITY_RECORDER
49+
#if UNITY_RECORDER && UNITY_EDITOR
5050
_mapLogger.AddLogger(_infoSequence);
5151
_infoSequence = FindObjectOfType<SequenceControllerBehaviour>() ?? gameObject.AddComponent<SequenceControllerBehaviour>();
5252
#endif
@@ -85,7 +85,7 @@ private void InitializationCompleted()
8585
if (!_waitForFirstLoadEvent)
8686
{
8787
//_readyForUpdates = true;
88-
#if UNITY_RECORDER
88+
#if UNITY_RECORDER && UNITY_EDITOR
8989
_infoSequence.Record(MapboxMap, Camera.main);
9090
#endif
9191
}

Runtime/Mapbox/MapDebug/Sequence/SequenceControllerBehaviour.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public async void Load()
4646
_recordedViewChanges = parser.ParseSequence((JObject) mapInfo);
4747

4848
var firstView = _recordedViewChanges.FirstOrDefault(x => x is SetCameraSequenceCommand) as SetCameraSequenceCommand;
49-
Map.mapInformation.SetInformation(firstView.center, firstView.zoom, firstView.pitch, firstView.bearing, firstView.scale);
49+
Map.MapInformation.SetInformation(firstView.center, firstView.zoom, firstView.pitch, firstView.bearing, firstView.scale);
5050
Map.LoadMapView(() => Debug.Log("file loaded"));
5151
}
5252

@@ -130,16 +130,16 @@ public void Record(MapboxMap map, Camera cam)
130130
var wait = new WaitSequenceCommand() {duration = 0};
131131
var set = new SetCameraSequenceCommand()
132132
{
133-
center = Conversions.WebMercatorToLatLon((GetCenterPosition() * Map.mapInformation.Scale).ToVector2d() + Map.mapInformation.CenterMercator),
134-
bearing = Map.mapInformation.Bearing,
135-
pitch = 90 - Map.mapInformation.Pitch,
136-
zoom = Map.mapInformation.Zoom,
137-
scale = map.mapInformation.Scale
133+
center = Conversions.WebMercatorToLatLon((GetCenterPosition() * Map.MapInformation.Scale).ToVector2d() + Map.MapInformation.CenterMercator),
134+
bearing = Map.MapInformation.Bearing,
135+
pitch = 90 - Map.MapInformation.Pitch,
136+
zoom = Map.MapInformation.Zoom,
137+
scale = map.MapInformation.Scale
138138
};
139139
_recordedViewChanges.Add(wait);
140140
_recordedViewChanges.Add(set);
141141

142-
Map.mapInformation.ViewChanged += RecordViewChanges;
142+
Map.MapInformation.ViewChanged += RecordViewChanges;
143143
}
144144
}
145145

@@ -166,7 +166,7 @@ public JObject DumpLogs()
166166

167167
//File.WriteAllText(FilePath, main.ToString());
168168

169-
Map.mapInformation.ViewChanged -= RecordViewChanges;
169+
Map.MapInformation.ViewChanged -= RecordViewChanges;
170170
//_isRecording = false;
171171
return main;
172172
}
@@ -190,7 +190,7 @@ private void RecordViewChanges(IMapInformation info)
190190
var wait = new WaitSequenceCommand() {duration = deltaTime};
191191

192192
var command = new SetCameraSequenceCommand();
193-
command.center = Conversions.WebMercatorToLatLon((GetCenterPosition() * Map.mapInformation.Scale).ToVector2d() + Map.mapInformation.CenterMercator);
193+
command.center = Conversions.WebMercatorToLatLon((GetCenterPosition() * Map.MapInformation.Scale).ToVector2d() + Map.MapInformation.CenterMercator);
194194
command.pitch = 90 - info.Pitch;
195195
command.bearing = info.Bearing;
196196
command.zoom = info.Zoom;

0 commit comments

Comments
 (0)