Short answer Yes. Starting with Unity Analytics SDK 6.2.0, you can add a custom TIMESTAMP parameter to your events and send a C# DateTime (or DateTimeOffset) directly. You can also send a timestamp as a string, but it must be in a valid RFC 3339/ISO 8601 format (for example, 2025-12-10T21:40:38.320Z).
Summary:
Unity Analytics validates event parameters against a server-side schema. For timestamps, you can now use a dedicated TIMESTAMP type (introduced in 6.2.0) or continue sending a string in RFC 3339/ISO 8601 format. The most common validation pitfalls are:
- Using a space between date and time (e.g., “2025-12-10 21:40:38.320”) instead of the ‘T’ delimiter.
- Omitting a timezone (e.g., missing Z or ±hh:mm).
- Sending parameters whose names or types don’t match what’s defined in Event Manager.
Follow the steps below to define the parameter, send a hardcoded timestamp, send “now” programmatically, and manually enter test values.
How to set up a custom timestamp:
- Define the event and parameter in Event Manager
- Go to Analytics > Event Manager.
- Create (or edit) your event.
- Add a parameter with:
- Name (for example, timestamp or sessionStartedAt).
- Type:
- TIMESTAMP (preferred in SDK 6.2.0+ for direct DateTime/DateTimeOffset), or
- STRING (if you’ll send a formatted timestamp string).
- Use a valid format if sending a string
- RFC 3339/ISO 8601 examples:
- UTC: 2025-12-10T21:40:38.320Z
- With offset: 2025-12-10T16:40:38.320-05:00
- Avoid space-delimited datetime without timezone (e.g., “2025-12-10 21:40:38.320”), which commonly fails validation.
Examples in C#:
A) Hardcode a timestamp (string)
// Hardcoded RFC 3339 UTC timestamp
CustomEvent myEvent = new CustomEvent("levelCompleted")
{
{ "timestamp", "2025-12-10T21:40:38.320Z" } // parameter name must match Event Manager
};
AnalyticsService.Instance.RecordEvent(myEvent);B) Generate “now” programmatically (string, RFC 3339)
using System;
// Format “now” as RFC 3339 with millisecond precision in UTC
string nowUtc = DateTimeOffset.UtcNow.ToString("yyyy-MM-dd'T'HH:mm:ss.fff'Z'");
CustomEvent myEvent = new CustomEvent("levelCompleted")
{
{ "timestamp", nowUtc }
};
AnalyticsService.Instance.RecordEvent(myEvent);C) Send a C# DateTime directly (TIMESTAMP parameter, SDK 6.2.0+)
using System;
// Ensure the parameter type in Event Manager is TIMESTAMP
CustomEvent myEvent = new CustomEvent("levelCompleted")
{
{ "timestamp", DateTime.UtcNow } // or DateTimeOffset.UtcNow
};
AnalyticsService.Instance.RecordEvent(myEvent);Manual entry (for testing tools or sample payloads)
- Valid examples you can paste:
- 2025-12-10T21:40:38.320Z
- 2025-12-10T16:40:38.320-05:00
- Invalid (likely rejected):
- 2025-12-10 21:40:38.320 // space delimiter, no timezone
- 2025/12/10T21:40:38Z // wrong date separators
- 2025-12-10T21:40:38 // missing timezone
Troubleshooting common errors
- “Additional property … found but was invalid” or “Constant schema ‘false’”
- The event or parameter name isn’t defined in Event Manager, or the type doesn’t match. Use the exact names and types you configured.
- “Invalid timestamp format”
- Ensure the ‘T’ delimiter and include a timezone (Z or ±hh:mm). Example: 2025-12-10T21:40:38.320Z.
Tips
- Prefer UTC (“Z”) for consistency and easier comparisons across regions.
- For local time with offset, use DateTimeOffset.Now and a format that includes the offset (e.g., “yyyy-MM-dd'T'HH:mm:ss.fffK”).
That’s it—define the parameter in Event Manager, then send either a C# DateTime (TIMESTAMP type) or a correctly formatted RFC 3339 string.