unity_native_plugin/
log.rs1use crate::define_unity_interface;
2use crate::interface::UnityInterface;
3use std::ffi::CStr;
4use unity_native_plugin_sys::*;
5
6#[repr(u32)]
7#[derive(Copy, Clone, PartialEq, Eq, Debug)]
8pub enum LogType
9{
10 Error = UnityLogType_kUnityLogTypeError,
11 Warning = UnityLogType_kUnityLogTypeWarning,
12 Log = UnityLogType_kUnityLogTypeLog,
13 Exception = UnityLogType_kUnityLogTypeException,
14}
15
16define_unity_interface!(
17 UnityLog,
18 IUnityLog,
19 0x9E7507fA5B444D5D_u64,
20 0x92FB979515EA83FC_u64
21);
22
23impl UnityLog {
24 pub fn log(&self, log_type: LogType, message: &CStr, file_name: &CStr, file_line: i32) {
25 unsafe {
26 self.interface().Log.expect("Log")(log_type as UnityLogType, message.as_ptr(), file_name.as_ptr(), file_line);
27 }
28 }
29}