Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SetCustomErrorMessage(int, AtomicSafetyErrorType, byte*, int)

Provides a custom error message for a specific job debugger error type, in cases where additional context can be provided.
Read time 1 minuteLast updated 14 days ago

Definition

[Conditional("ENABLE_UNITY_COLLECTIONS_CHECKS")]public static void SetCustomErrorMessage(int staticSafetyId, AtomicSafetyErrorType errorType, byte* messageBytes, int byteCount)

Parameters

staticSafetyId

The static safety ID with which the provided custom error message should be associated. This ID must have been allocated with AtomicSafetyHandle.NewStaticSafetyId. Passing 0 is invalid because 0 is the default static safety ID, and its error messages cann't be modified.

The class of error that should use the provided custom error message instead of the default job debugger error message.

messageBytes

The error message to use for the specified error type. This should be a UTF8-encoded byte array, and doesn't have to be null-terminated.

byteCount

The number of bytes in the
messageBytes
array, excluding the optional null terminator.

Remarks

The job debugger uses the specified static safety ID and error type to look up error messages for AtomicSafetyHandle instances. You should provide a message for each applicable type of error defined in AtomicSafetyErrorType. Without a specific error message, the job debugger only gives general error messages that might not clearly identify the source of the error.
If the message contains any of the following sequences, they are replaced with the corresponding context-specific data (if available) when the message is emitted:
  • {2} = this job name. example: "BoidsJob"
  • {3} = this job field. example: "BoidsJob.boidsBuffer"
  • {5} = this owner type. example: "NativeArray\<int\>"