Apple TV native plugin folder?

I’m trying to write a native plugin for Apple TV, but whenever I build, Unity doesn’t include my code in the generated Xcode project.

The iOS documentation lists Assets/Plugins/iOS as the directory to use (Unity - Manual: Building Plugins for iOS)

The Apple TV documentation doesn’t list anything of the sort: Unity - Manual: Building games for Apple TV

I’ve tried copying my iOS directory as tvOS, but it still doesn’t pick up the source files when I build for Apple TV.

Is this supported for Apple TV? And if so, what directory should I use?

1 Like

I’m surprised that Plugins/tvOS directory doesn’t work. Can you submit a bug report?

You can adjust import settings for specific native plugin (just select it in project window) in Unity inspector. Checking tvOS platform there should be enough.
P.S. bugreport for Plugins/tvOS still would be welcome.

1 Like

OK, maybe I’m just doing this wrong. Let me paint a picture of what I’m trying to accomplish:

I have a native plugin that I want to have available on many platforms (iOS, tvOS, Android, and Mac for starters). I have some source files that are common to iOS, tvOS, and Mac. I want this to be a drop-in thing, where someone drops in my plugin and it just works.

If I put the source files in the iOS subdir, it compiles fine for iOS but none of the files are included for a tvOS build. If I make a copy of the iOS dir and call it tvOS, it works fine for tvOS, but then when I try to build for iOS, it complains about plugins colliding with each other, and points me to the source files I’ve duplicated. Not sure why since the iOS build should be ignoring stuff in tvOS. I don’t want to have them in the iOS dir and then require instructions telling the end user to also click tvOS for all the source files.

Now for Mac it looks like the process is different again, in that I have to precompile the source files and store the resulting bundle… somewhere… I’m not sure where.

Actually, is there some kind of configuration file that would just let me say “Hey, use these source files for these platforms”?

Actually what Mantas has suggested will still fix your issue.

You can have the following structure:
Assets/Plugins/YourPlugin/
PluginFileOSX (mark OSX platform in the plugin importer settings of this file)
PluginFileCommonToiOStvOS (mark iOS and tvOS in the plugin importer settings)
PluginFileiOS (mark iOS in the plugin importer settings)
PluginFileCommon (mark all platforms in the plugin importer settings)
etc. etc.

The idea is that you should use plugin importer for each file to set the applicable architectures, which is much more versatile than hardcoding paths. The Assets/Plugins/YourPlugin/ directory will still be drop-in, since the plugin importer settings are stored within the meta files of the respective plugins