I can’t find anything that’s platform specific for AppleTV.
This doesn’t list the AppleTV
Nor does this:
So how do I make C# code that only executes on AppleTV / tvOS?
I can’t find anything that’s platform specific for AppleTV.
This doesn’t list the AppleTV
Nor does this:
So how do I make C# code that only executes on AppleTV / tvOS?
#if UNITY_TVOS
Thank you!
The documentation and Monodevelop autocomplete are a bit lacking with tvOS info.
I noticed the same thing tonight, but at least the preprocessor is available.
However I’ve got a bigger problem migrating our code over to make use of the new integrated tvOS platform (over from the older beta version of Unity for tvOS). It appears that there’s no PlayerSettings.tvOS available to code at all.
This address doesn’t load anything:
But worse is that code like this is invalid which I need for a highly customised compiler script:
PlayerSettings.tvOS.buildNumber
Any idea when this might become available?
EDIT: I thought this might get buried so created a new thread for the topic here:
I have a question for you about TVOS Easy Input Helper - (bought it yesterday). How do you access the Volume up/down button on the remote?
I have sliders for sound volume, so I’m trying to figure out how to adjust the sound (I have three sliders for music, sound, and FX). Swiping takes me to the next GUI item (navigation).
Volume up/down physical buttons are not allowed by Apple to be used by your application they are reserved for the system. This applies to my asset and also Unity or native apps. You are only allowed to use the touchpad click, and the play/pause button. You are able to use part of the menu button as well but only the quick click (long click is reserved). Also, menu button has strict guidelines that will get your app rejected if you don’t follow. In general you should have it exit to Apple TV home from your title screen and pause/return to your title screen from your game scene. Basically it should perform similar to how Apple’s settings app works you can use it to get a feel for what there guidelines are saying.
The best way to do volume is probably via a scrollbar which it sounds like you are attempting. You can certainly use scrollbars with Easy Input Helper, I’ll post general guidelines here that I’ve also posted elsewhere for dealing with scrollbars. In general I would just set the volume level to the value of the scrollbar.
Repost of guidelines:
Scrollbars are like any other UI object on a panel the only thing to be aware of is if you leave it on automatic navigation the placement of the scrollbar is very important. In practice I usually find that scrollbars are big enough that I want to set the navigation to explicit and manually select where I’m going to navigate to on each of the directions. If you do this make sure that the items you want to scroll are set to none (if its a vertical scrollbar that would mean up and down should be set to none). The other directions (in the example left/right) set to which button or other UI object you want to select when you swipe that way. If you leave it to automatic it will navigate based on where in the scroll it currently is and since scrollbars are usually long that would mean if its near the top it will want to navigate towards high buttons but if its near the bottom it will navigate towards low buttons and this isn’t always desirable. You can also set it to horizontal or vertical if automatic behavior is ok but it’s getting confused on which way it should scroll and which way it should navigate away.
You can also programatically select the scrollbar it’s treated like any other UI object, you certainly can if you want to via the normal EventSystem call to select via code but usually it’s not necessary.
Hope that helps.
When I switch back to iOS platform and try to build, I’m getting this error:
Assets/Easy Input Helper/Scripts/Core/EasyInputHelper.cs(1006,22): error CS0161: `EasyInput.Core.EasyInputHelper.getControllerButtonState(EasyInput.Core.EasyInputConstants.PLAYER_NUMBER, EasyInput.Core.EasyInputConstants.CONTROLLER_BUTTON)': not all code paths return a value
The scenes I’m building for the iOS version don’t use TVOS Easy Input Helper, and I can’t build the iOS version because of this error.
Any ideas? EasyInputHelper.cs isn’t attached to anything in the iOS only scenes.
Thanks for finding this. I’ll get this fixed in the next build with new features (will be about 2 weeks). In the meantime you can fix this by adding the following code to EasyInputHelper.cs after line 1106 and before 1107.
#if !UNITY_EDITOR && !UNITY_TVOS
return false;
#endif
This only will show up when not in editor and not building for TVOS (only shows up for cross platform games). Adding that code will fix the build issue on the other platforms (android, IOS, etc.) when not in editor.