So now that Unity 5 is out, is there any news if we can build live wallpapers again?
There was a plugin back in version 3.6-4.0 which was able to export, but in 4.x the developer said that something is not exposed in the Unity API which didn’t allow it to work in further Unity versions.
So if anyone has any info at all, is it possible to build live wallpapers now?
I’ve recently mailed the Unity Support, asking if they can put me in touch with someone of the dev team to know if they was any kind of hack to start the Unity Player 5 in a LWP. Here is technical team response, and it’s pretty interesting:
‘‘It’s a kind of hack and not officially supported by Unity. This hack stopped working after 4.1. The Android team said that in Unity 5 you can attach your own custom surface to the Unity player Java which could do the job. On the UnityPlayer java object there is a function that can be used to attach surface objects either as the primary surface (using index zero) or as secondary surfaces using index 1-15. Of course you need to write your own wallpaper service and handle lifecycle and other on your own.’’
The Unity documentation isn’t exhaustive on the surface object attachment: no documentation on this feature , I only found a public function links to the java Unity Player V5, player.displayChanged(0,surfaceHolder)
But the big question is still the same… It’s still impossible to start the Unityplayer with the Wallpaper Service Context. So how should we do? we can start the UnityPlayer using an activity before using the UnityPlayer in the Wallpaper Service, but this method sounds terrible and I am not even sure it’s works.
SO, is somebody has an idea on how to use the player.displayChanged(0,surfaceHolder) in the Java Unity player, and how we can use it to run the Unity Player in the Wallpaper Service?
Bummed out to see this is still an unanswered issue. I started looking into the feasibility of using UnityPlayer within a Service and have hit the hurdle that is being described in this thread.
It would seem that while UnityPlayer’s constructor takes a Context for it’s only parameter, there is a method within UnityPlayer that makes the assumption that the context is an instanceof Activity and casts it as an Activity. This method is called inside UnityPlayer(Context context) and causes a ClassCastException to be thrown immediately.
I’m going to modify the unity-classes.jar to work around this just to see if I can get any further along with making this happen.
I’ve recently released uLiveWallpaper - a Unity asset that makes it possible to create live wallpapers for Android using Unity 5. It is well-tested and reliable, creates projects for Android Studio, complete with placeholder code to get you started.
I have made Android live wallpaper creation using Unity accessible to non-programmers using my plugin ALPS. It allows live wallpaper creation with no need for AndroidStudio. You can build and launch live wallpapers all from within Unity Editor itself. ALPS will be submitted to AssetStore in a couple of days days.