private static List<Vector3> nodeListFromAsset( string pathAssetName )
{
if( Application.platform == RuntimePlatform.WebGLPlayer )
{
Debug.LogError( "The Web Player does not support loading files from disk." );
return null;
}
var path = string.Empty;
if( !pathAssetName.EndsWith( ".asset" ) )
pathAssetName += ".asset";
if( Application.platform == RuntimePlatform.Android )
{
path = Path.Combine( "jar:file://" + Application.dataPath + "!/assets/", pathAssetName );
WWW loadAsset = new WWW( path );
while( !loadAsset.isDone ) { } // maybe make a safety check here
return bytesToVector3List( loadAsset.bytes );
}
else if( Application.platform == RuntimePlatform.IPhonePlayer )
{
// at runtime on iOS, we load from the dataPath
path = Path.Combine( Path.Combine( Application.dataPath, "Raw" ), pathAssetName );
}
else
{
// in the editor we default to looking in the StreamingAssets folder
path = Path.Combine( Application.streamingAssetsPath, pathAssetName );
}
#if UNITY_WEBPLAYER || NETFX_CORE || UNITY_WP8
// it isnt possible to get here but the compiler needs it to be here anyway
return null;
#else
var bytes = File.ReadAllBytes( path );
return bytesToVector3List( bytes );
#endif
}