Hello,
we're planning to deploy our AC game on Nintendo Switch and we wanted to run some tests on the official devkit to see how to handle controls, but as soon as we change build platform to the Switch, we get a copile error saying it cannot find the type VideoPlayerData in the FileFormatHandler_Json file. I looked into it and it seems that with the "UNITY_SWITCH" compile flag active a huge chunk of code gets cut out by the absence of the usually present "ALLOW_VIDEO" flag, which is controlled by the following preprocessor directive:
#if !UNITY_SWITCH
#define ALLOW_VIDEO
#endif
What am I supposed to do to make it work? (I'm using AC 1.73.6 on Unity 2020.3.8f1
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
What is the compilation error, exactly?
In the past, Unity's VideoPlayer component was not supported by the Switch - at least, as I understood it.
It looks like this is no longer the case, however. See this recent thread regarding how to lift the restriction - if you can confirm to me that it succesfully compiles, I can look into making a similar change in the next release.
The type or namespace name 'VideoPlayerData' could not be found (are you missing a using directive or an assembly reference?) is the error I get. I don't use the video player as for now, thus I cannot confirm if it works as intended on Switch. But I can confirm that replacing the #if-#endif directives with just
#define ALLOW_VIDEO
makes everything compile just fine.If it can help, the issue came from the fact that in the FileFormatHandler_Json (in the
DeserializeObjectJson(string jsonString)
method) the following piece of code is gated behind the#if ALLOW_VIDEO
directive:but towards the end of the method there is yet another similar if block which is NOT gated behind the same directives:
This means the first if block doesn't cause any issues, since the #if-#endif directiv prevents it from being compiled, but the last one is the responsible for the compile error mentioned at the start.
Thanks for the details.