Skip to content

Commit 0e84d6f

Browse files
Fix warnings (#38)
* Fixing compilation warnings and ensure warnings are treated as errors in test projects. * Updating changelog
1 parent 2dfcc26 commit 0e84d6f

File tree

11 files changed

+31
-13
lines changed

11 files changed

+31
-13
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-warnaserror+

TestProjects/PerceptionHDRP/Assets/csc.rsp.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TestProjects/PerceptionURP/Assets/ExampleScripts/CustomAnnotationAndMetricReporter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[RequireComponent(typeof(PerceptionCamera))]
66
public class CustomAnnotationAndMetricReporter : MonoBehaviour
77
{
8-
public GameObject light;
8+
public GameObject targetLight;
99
public GameObject target;
1010

1111
MetricDefinition lightMetricDefinition;
@@ -28,7 +28,7 @@ public void Start()
2828
public void Update()
2929
{
3030
//Report the light's position by manually creating the json array string.
31-
var lightPos = light.transform.position;
31+
var lightPos = targetLight.transform.position;
3232
DatasetCapture.ReportMetric(lightMetricDefinition,
3333
$@"[{{ ""x"": {lightPos.x}, ""y"": {lightPos.y}, ""z"": {lightPos.z} }}]");
3434
//compute the location of the object in the camera's local space
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-warnaserror+

TestProjects/PerceptionURP/Assets/csc.rsp.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

com.unity.perception/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1515
### Removed
1616

1717
### Fixed
18+
Fixed compilation warnings with latest com.unity.simulation.core package.
1819

1920
### Security
2021

com.unity.perception/Documentation~/DatasetCapture.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ using UnityEngine.Perception.GroundTruth;
2626
[RequireComponent(typeof(PerceptionCamera))]
2727
public class CustomAnnotationAndMetricReporter : MonoBehaviour
2828
{
29-
public GameObject light;
29+
public GameObject targetLight;
3030
public GameObject target;
3131

3232
MetricDefinition lightMetricDefinition;
@@ -49,7 +49,7 @@ public class CustomAnnotationAndMetricReporter : MonoBehaviour
4949
public void Update()
5050
{
5151
//Report the light's position by manually creating the json array string.
52-
var lightPos = light.transform.position;
52+
var lightPos = targetLight.transform.position;
5353
DatasetCapture.ReportMetric(lightMetricDefinition,
5454
$@"[{{ ""x"": {lightPos.x}, ""y"": {lightPos.y}, ""z"": {lightPos.z} }}]");
5555
//compute the location of the object in the camera's local space

com.unity.perception/Runtime/GroundTruth/Labelers/SemanticSegmentationLabeler.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ void OnSemanticSegmentationImageRead(int frameCount, NativeArray<Color32> data)
193193
height = targetTexture.height,
194194
path = localPath
195195
};
196-
asyncRequest.Start((r) =>
196+
asyncRequest.Enqueue((r) =>
197197
{
198198
Profiler.BeginSample("Encode");
199199
var pngBytes = ImageConversion.EncodeArrayToPNG(r.data.data.ToArray(), GraphicsFormat.R8G8B8A8_UNorm, (uint)r.data.width, (uint)r.data.height);
@@ -205,6 +205,7 @@ void OnSemanticSegmentationImageRead(int frameCount, NativeArray<Color32> data)
205205
r.data.data.Dispose();
206206
return AsyncRequest.Result.Completed;
207207
});
208+
asyncRequest.Execute();
208209
}
209210

210211
/// <inheritdoc/>

com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,11 @@ public void AddScriptableRenderPass(ScriptableRenderPass pass)
6363

6464
bool m_CapturedLastFrame;
6565
Ego m_EgoMarker;
66+
67+
#pragma warning disable 414
6668
//only used to confirm that GroundTruthRendererFeature is present in URP
6769
bool m_GroundTruthRendererFeatureRun;
70+
#pragma warning restore 414
6871

6972
/// <summary>
7073
/// The <see cref="SensorHandle"/> associated with this camera. Use this to report additional annotations and metrics at runtime.
@@ -171,7 +174,7 @@ void CaptureRgbData(Camera cam)
171174
using (s_WriteFrame.Auto())
172175
{
173176
var dataColorBuffer = (byte[])r.data.colorBuffer;
174-
177+
175178
byte[] encodedData;
176179
using (s_EncodeAndSave.Auto())
177180
{

com.unity.perception/Runtime/GroundTruth/SimulationState_Json.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,12 @@ void Write(List<PendingCapture> pendingCaptures, SimulationState simulationState
188188
PendingCaptures = pendingCapturesToWrite,
189189
SimulationState = this
190190
};
191-
req.Start(r =>
191+
req.Enqueue(r =>
192192
{
193193
Write(r.data.PendingCaptures, r.data.SimulationState, r.data.CaptureFileIndex);
194194
return AsyncRequest.Result.Completed;
195195
});
196+
req.Execute(AsyncRequest.ExecutionContext.JobSystem);
196197
}
197198

198199
m_SerializeCapturesSampler.End();
@@ -256,11 +257,12 @@ void Write(List<PendingMetric> pendingMetrics, int metricsFileIndex)
256257
MetricFileIndex = m_MetricsFileIndex,
257258
PendingMetrics = pendingMetricsToWrite
258259
};
259-
req.Start(r =>
260+
req.Enqueue(r =>
260261
{
261262
Write(r.data.PendingMetrics, r.data.MetricFileIndex);
262263
return AsyncRequest.Result.Completed;
263264
});
265+
req.Execute();
264266
}
265267

266268
m_MetricsFileIndex++;

0 commit comments

Comments
 (0)