Build flags for resources

So here’s the question… Is there a way to specify a resource only be included in the stand alone player vs. the web player.

For instance I’ve got the following bit of code to stream audio off of my web server if in a WebPlayer or load from Resources otherwise.

var path = "http://www.splatsosoft.com/site/unity/sidewinder.ogg";

function Start () {
	if(Application.platform==RuntimePlatform.OSXWebPlayer  || Application.platform==RuntimePlatform.WindowsWebPlayer) GetWWWAudio();
	else GetLocalAudio();
}


function GetLocalAudio(){
	var clip : AudioClip = null;
	clip = Resources.Load("Music/Sidewinder");
	if (clip != null){
		audio.clip = clip;
	}
	else print("Clip is NULL!");
}

function GetWWWAudio(){
	// Start downloading
	var download = new WWW (path);
	// Wait for download to finnish
	yield download;
	// Create ogg vorbis file
	var clip : AudioClip = download.oggVorbis;
	// Play it
	if (clip != null){
		audio.clip = clip;
//		audio.Play();
	}
	// Handle error
	else{
		Debug.Log("Ogg vorbis download failed. (Incorrect link?)");
	}
}

The problem is that the Sidewinder file is packaged in the player no matter what because GetLocalAudio() uses it (increasing the file size). So I want to know if there is a way to tell Unity to only include the Sidewinder.ogg (or any other resource) in the package if it is not a web build. Or if anyone has some way to do this with a different bit of code.

Thanks!
Jeff

Right now the only way to do that is by moving it out of the Resources folder before building.

So will we see an easier (read more automated) way to do this in a future version? :slight_smile:

Jeff

was this ever changed/fixed? issues like this are becoming a big time waster for desktop-standalone mobile development!