Ameba Ownd

アプリで簡単、無料ホームページ作成

Unity downloading streaming assets file from hololens

2021.12.15 22:39






















Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 2 years ago. Active 2 years ago. Viewed 2k times. Thanks beforehand The current test text file is called cont. Networking; using System. WriteAllText savePath, www. Improve this question. What error are you getting? I forgot to mention there is no error just its not doing what is suppossed to do, in this case download the txt file — asdronin.


Joined: Nov 30, Posts: Jarediavionic likes this. Ah ok, Thank you for the clarification and the link timke Greatly appreciated. If I change the file path to my desktop and try it in the editor it works perfect just never on the hololens. Label new Rect 10 , 10 , , 30 , "Sheet Name:" ;. Open , FileAccess. Read , FileShare. Read ;. CreateSheet MySheetName ;. CreateRow short i ;. CreateCell short 0 ;. CreateCell short 1 ;.


SetCellValue "" ;. Connect and share knowledge within a single location that is structured and easy to search. I'm working on a Hololens app that displays a PNG image with info for the user.


The images are loaded from a StreamingAssets folder in a coroutine. The issue lies in the speed at which these assets are loaded. What I hope some of you can help me with is think of ways to optimize the storage and streaming of these images. Is there a way to for example, load the image in a lower resolution to save on time and memory with the hardware's very limited memory and load in the additional detail when it actually needs to be displayed? Would multi-threading make the framerate better while loading the image?


So Programmer's suggestion in the comments helped eliminate the performance issues completely. The code down below is the coroutine that is used to stream in the required image s upon startup. The issue on the Hololens lies in the www. LoadImageIntoTexture tex ; line. This code is required when displaying multiple images on the PC side of things, however on the Hololens, where only one image is displayed at a time it can be left out. Stack Overflow for Teams — Collaborate and share knowledge with a private group.


In the Unity Editor, select the Game Manager from the Hierarchy Window to expose the public variables in the inspector. But wait! There is no way your awesome new avatar would jump into their tank without their own custom soundtrack, right? On to that next. Drag your audio file into the Project Window StreamingAssets folder and rename the file soundtrack.


Note : There are many different audio file types out there. If you have trouble, convert the file to. Have a look here for free online conversion tools, but be warned: DRM-protected files will not convert. Head back to the GameManager Start function and add a new conditional underneath the other one to pass the soundtrack file to a new Coroutine :.


This code should look pretty familiar. Loading an audio file is very similar to loading a texture. You use the URL to load the file and then apply audio to musicPlayer's clip property. Finally, you call Play on musicPlayer to get the soundtrack thumping. Now to customize the tank model. The first will use simple color swatches to let the user apply their favorite colors to the tank.


The second will be a complete re-skin, similar to Minecraft skin mods. Find the small 20 x 10 pixel playercolor image in the TankArenaAllAssets resources folder that came with the starter project download. Add the following new variables to the Game Manager , all under the new Header tag Tank Customisation :.


Additionally, you save the military green primary and red accent secondary color values as integers in a Vector3 for the upcoming conditional statements. You use GetComponentsInChildren to fetch all of the renderers in the tank model and apply the new modified texture.


With the primary and secondary colors replaced. The texture is applied to the tank. GetComponentsInChildren , rather counter-intuitively, fetches the requested component in the parent GameObject. In this particular model, the tank treads have their own texture. You have to reapply this, otherwise your tank will have "tank" tank treads, and that's just weird! You also place this part of the tank customization in it's own public method as you'll need identical functionality to this later.


Ensure Game Manager is selected in the Hierarchy Window. You will find the two default texture files used to skin the tank model. The other way to customize tanks is to let the user add new skins to streaming assets and let them select and apply them at runtime. Some tank "skin" textures were included in the TankArenaAllAssets folder that you got along with the starter project download. Place them in the Project Window StreamingAssets folder now.


The skins and their names will be stored in Lists. Therefore, add the Generic namespace at the top of the Game Manager script;. Note : For this tutorial, you simply throw up a loading screen for one second before gameplay starts as this is sufficient for demonstration purposes. For a real game, you may want to add a cool little cut scene if you expect a more involved loading stage, and perhaps a callback of some sort when loading is finally complete.


For this tutorial, you'll assume that when the loading screen dismisses, all of the streaming assets have been processed. ConfigureSkin saves the index it was passed in a private variable and the button label is customized using the skin name. This extracts the relevant texture from the list and applies it to the players tank.


You also remove the pause menu and resume gameplay. Finally, drag the content object into the skinContainer variable. Tap the play button and press Escape to pause the game. Tap a button and select a new skin for the tank:. Okay, it's time to move on to custom level design and creation.