Is it possible to exclude Assets depending the target platform ?

Hello,

My current application plays video - depending the target platform I use MovieTexture or Handheld.PlayFullScreenMovie.

I do manage, I think, to put all MovieTexture references into #if UNTY_STANDLONE block in order to avoid the following message :

But now, when I try to compile for Android for instance, I have this error message :

So the build failed and I don’t know how to tell the build to exclude the Assets/videos folder - I don’t even know if it’s possible.

Thank you.

ps : is there a best practice when it comes to play video and targeting standalone and mobile platform ?

Compile the assets into an AssetBundle, AssetBundles when built have a target platform set.

Now, where you have code that is for your target platform that uses the AssetBundle (between the UNITY_STANDALONE lines). You load the AssetBundle and pull the assets out from it.

Hi,

It means that the application would have to load the asset bundle - so it will need an internet connection, is that right ?

Thank you

You can load asset bundles from disk:

If you don’t want to do that you can also do this: (bit hacky though)

  1. Do all your builds through a script using BuildPipeline.BuildPlayer

  2. In the script move any assets somewhere else before doing the build (using AssetDatabase.MoveAsset)

  3. Do the build and then move the assets back