Skip to content

Commit 9a2c7ab

Browse files
committed
Update profiler
1 parent 167ec03 commit 9a2c7ab

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

unity-native-plugin/src/profiler.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl ProfilerMarkerDataType {
167167
pub enum ProfilerMarkerDataUnit {
168168
Undefined = UnityProfilerMarkerDataUnit__kUnityProfilerMarkerDataUnitUndefined as u8,
169169
TimeNanoseconds =
170-
UnityProfilerMarkerDataUnit__kUnityProfilerMarkerDataUnitTimeNanoseconds as u8,
170+
UnityProfilerMarkerDataUnit__kUnityProfilerMarkerDataUnitTimeNanoseconds as u8,
171171
Bytes = UnityProfilerMarkerDataUnit__kUnityProfilerMarkerDataUnitBytes as u8,
172172
Count = UnityProfilerMarkerDataUnit__kUnityProfilerMarkerDataUnitCount as u8,
173173
Percent = UnityProfilerMarkerDataUnit__kUnityProfilerMarkerDataUnitPercent as u8,
@@ -378,6 +378,18 @@ define_unity_interface!(
378378
macro_rules! impl_profiler_v2 {
379379
() => {
380380
impl_profiler!();
381+
382+
pub fn create_category(&self, name: &std::ffi::CStr, unused: u32) -> Option<ProfilerCategoryId> {
383+
unsafe {
384+
let mut category: UnityProfilerCategoryId = std::mem::zeroed();
385+
let r = self.interface().CreateCategory.expect("CreateCategory")(&mut category as *mut UnityProfilerCategoryId, name.as_ptr(), unused);
386+
if r > 0 {
387+
Some(category)
388+
} else {
389+
None
390+
}
391+
}
392+
}
381393
}
382394
}
383395

0 commit comments

Comments
 (0)