videokit
videokit copied to clipboard
UnityPlayer crashes when using Japanese paths(User Name) when recording starts on Windows.
About
- the UnityPlayer crashes when using Japanese paths(User Name) on Windows.
- Similar problems have been reported on the forum and I have the same fix to avoid the Japanese pass, but UnityPlayer crashes when I try to use the recording feature.
- a possible cause is that NatCorder.Dll does not support multibyte characters.
How to reproduce the Crush
Create two local users (one is the Japanese name and the other is the English name) Users with Japanese names will crash when recording starts Users with English names are normal when recording starts
Crush when the following code is executed
Recorder = new MP4Recorder(256, 144, Framerate, _SampleRate, _ChannelCount, audioBitRate: 96_000);
System Information
CPU : Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz 3.20 GHz RAM : 32GB OS : Windows 11 Pro(22621.1992) UnityVersion : 2020.3.48f1 NatCoderVersion : 1.8.8(I tried v1.9.4 and it still crushed.)
Other
.\[email protected]\Runtime\RecorderExtensions.cs:57 was rewritten with the following code, new MP4Recorder(...)
worked, ~~but it crushed at the start of recording.~~
[RuntimeInitializeOnLoadMethod]
private static void OnInitialize () {
var editor = Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.WindowsEditor;
const string workingDirectoryPath = @"c:\tmp\";
Directory.CreateDirectory(workingDirectoryPath);
foreach (var filePath in Directory.GetFiles(workingDirectoryPath)) { File.Delete(filePath);}
directory = editor ? Directory.GetCurrentDirectory() : workingDirectoryPath; //Application.persistentDataPath;
}