Difference between revisions of "XBOX 360 Getting Starting"
Line 146: | Line 146: | ||
===Examples=== | ===Examples=== | ||
See “Xbox 360 - Native Plugin Example” package. | See “Xbox 360 - Native Plugin Example” package. | ||
+ | |||
+ | |||
+ | ==Video Playback== | ||
+ | Full-screen video playback on the Xbox can be done using functions in the UnityEngine.X360VideoPlayer class. | ||
+ | |||
+ | # Video files must be placed in the PROJECT\Assets\StreamingAssets folder. See Project Structure for more details. | ||
+ | # Specify an absolute path when loading video files on the Xbox: _game:\Media\Raw_. | ||
+ | # Playing a video will automatically disable the gamer’s background music (see TCR 024). | ||
+ | # Playback is based on XMedia2 library. See the Xbox 360 SDK Documentation for details. |
Revision as of 22:00, 7 June 2020
Contents
- 1 Xbox 360: Getting Started
- 2 SETUP
- 3 Project Structure
- 4 Project Settings
- 4.1 Build Type
- 4.2 Explicit Null Checks
- 4.3 Compress Libs
- 4.4 Run Method
- 4.5 Title Id
- 4.6 ImageXEX config override
- 4.7 SPA config
- 4.8 Generate _SPAConfig.cs
- 4.9 Enable Avatar rendering
- 4.10 Deploy Kinect resources
- 4.11 Deploy Speech resources
- 4.12 Enable Kinect
- 4.13 Enable Kinect AutoTracking
- 4.14 Enable Kinect Fitness
- 4.15 Enable GPU skinning
- 4.16 Stripping Level
- 5 Building Plugins for Xbox 360
- 6 Video Playback
Xbox 360: Getting Started
Developing for Xbox 360
To develop for the Xbox 360 you must be a Microsoft Certified Xbox 360 Developer and own the appropriate hardware. See the Xbox 360 Setup page for a seat setup checklist.
Access Xbox 360 unique functionality
Unity Xbox provides a number of new scripting APIs to access Xbox Live services, storage devices, Avatars and much more. See the UnityEngine.X360 namespace in the scripting API.
How Unity Xbox differs from Desktop Unity
Strongly Typed JavaScript
- Dynamic typing in JavaScript is always turned off in Unity on Xbox. This is the same as adding #pragma strict to your scripts, but it is done by default instead, in order to improve performance. When you launch an existing Unity Project, with dynamic typing, you will see compiler errors. You can easily fix them by either using static typing for the variables that are causing errors or taking advantage of type interface.
Ahead-Of-Time (AOT) compilation
- Scripts are AOT compiled and loaded in as normal Xbox 360 dynamic libraries. JITing is not supported.
- Exotic class libraries (reflection, LINQ etc) not fully supported.
Limited memory
- Expect about 440MB free system memory with an empty project loaded.
Fixed resolution
- 720p (1280x720) is the only resolution you’ll have to deal with.
No hardware MSAA
- Unity for Xbox does not do hardware MSAA. Use “AntialiasingAsPostEffect” technique “FXAA3” from the “Image Effects” standard package for best results.
XMA audio compression
- Unity will compress audio to XMA when targeting Xbox 360.
- Unity will use OGG in the editor (XMA can not be played on the PC). Expect audio quality to differ and check the output Xbox produces.
- Only two channels are supported when load type is “Compressed in memory”.
SETUP
Step-by-step guide for installing Unity for Xbox 360:
- Install Visual Studio 2010
- Install Microsoft XDK (Full)
- XEDK environment variable must be set up - XDK setup does this automatically.
- Exact version number will be provided with every Unity build.
- Set up a default devkit or testkit in your Xbox 360 Neighborhood.
- Install Unity.
Build information:
- XDK version: November 2012, #21250.7.
Project Structure
Special directories:
PROJECT/Assets/StreamingAssets - for assets that Unity should not process. Files are copied to OUTPUT\Media\Raw.
- Videos.
- Asset bundles.
- Custom assets.
PROJECT/Assets/Plugins - for native plugins. .def and .xex files are copied to OUTPUT\Media\Plugins.
Runtime paths:
- Xbox mounts the game folder to game:.
- Unity executable is located at game:\Project.XEX.
- Unity data files are located at _game:\Media_.
- Unity compiled script assemblies are located at _game:\Media\Managed_.
- Raw assets are located at _game:\Media\Raw_.
Project Settings
Unity for Xbox 360 comes with additional project settings.
Build Type
Debug player has full debug output and asserts enabled.
- Editor-player connection enabled.
- Unity profiler enabled.
- Full debug information emitted to standard output.
- Linked with debug libs.
- PDBs for managed code emitted to BUILD_TARGET\Media\Managed.
Development player has most of the debug functionality required for normal development.
- Editor-player connection enabled.
- Unity profiler enabled.
- Critical debug information emitted to standard output.
- Linked with instrumented libs to enable PIX captures.
- PDBs for managed code emitted to BUILD_TARGET\Media\Managed.
Master player is TCR compliant.
- All standard output disabled.
- Linked with retail libs.
Explicit Null Checks
Development Build feature that enables you to catch null references. Enabling it will cause the compiler to emit explicit null checks around every managed deref operation and throw a NullPointerException. This does influence performance slightly. Disabling it will cause the console to crash under the same conditions. See Debugging for more details.
Compress Libs
Enables compression of the main executable and script assemblies. Decreases project boot time (esp. from DVD), but increases build time.
Run Method
“Build and Run” command behavior can be customized:
- Copy to HDD - the usual way of testing Xbox 360 applications. The whole project output folder is copied to a devkit.
- DVD Emulation - a disc layout file AutoLayout.XGD is created in the project output folder and the Game Disc Emulator is started. Devkit must be connected via the DVD EMU USB port (see DVD Emulation_ in the Xbox 360 SDK Documentation for details). Note that you will have to close the Game Disc Emulator window prior to the next build.
- No timing - the emulator does not emulate DVD behavior or introduce any latency into file read times.
- Accurate - the emulator emulates DVD behavior by introducing accurate latency based on the LBAs of the files accessed. Note that the automatically generated layout might be suboptimal for your game.
Title Id
Title id of your game. Format: ABCD1234. Contact your developer account manager at Microsoft for details. A title id is required by certain Xbox features (i.e. storage or Xbox Live services).
ImageXEX config override
Specifies a configuration file for the XEX image conversion tool. Unity player is converted to a XEX during the process. See XEX Image Converter in the Xbox 360 SDK Documentation for details.
SPA config
Specifies a SPA configuration file to be embedded in the executable. This configuration is required by certain Xbox features (i.e. Xbox Live services). Step-by-step guide:
- Download the Xbox LIVE Publishing Toolkit from the Xbox Developer site.
- Prepare a configuration using the Xbox LIVE Game Configuration tool and upload it to PartnerNet. See LIVE Environments in the the Xbox 360 SDK Documentation for details.
- Generate the .SPA and .SPA.H files for your configuration.
- Enter the path to the .SPA file.
Generate _SPAConfig.cs
Convenience feature enabled only when the SPA config is specified. Enabling this will have Unity look for a .SPA.H file in the same folder as the specified .SPA file and convert it to a Unity script containing a single enum SPAConfig. Hardcoding values is not an option as they may change after rebuilding the SPA files.
Enable Avatar rendering
Initializes the Avatar system. See Avatars for more details.
Deploy Kinect resources
Copies Kinect resources (Database.xmplr and NuiIdentity.bin.be) to the project output folder.
Deploy Speech resources
Copies Speech resources (selected languages) to the project output folder.
Enable Kinect
Enables Kinect systems in UnityEngine.Kinect.
Enable Kinect AutoTracking
Enables automatic skeleton tracking. If disabled, UnityEngine.Kinect.Skeleton.SetTrackedSkeletons must be called to specify tracked skeletons. Only visible if Enable Kinect is checked.
Enable Kinect Fitness
Enables Kinect Fitness API.
Enable GPU skinning
Enables Unity to use a GPU skinning path with memexport.
Stripping Level
Enables code stripping. Strips managed bytecode and unused native code. Greatly reduces DLL size and boot time. “micro mscorlib” is not available for Xbox 360. Selecting it will act as “Strip ByteCode”.
Building Plugins for Xbox 360
Plugin requirements:
- Linked against the same libraries as Unity.
*Development Build uses instrumented XDK libraries. *Non-development Build uses release XDK libraries.
- Access to certain system services might not be possible if Unity already uses them:
*Avatar system can be disabled in Player Settings if a custom implementation is desired.
Plugin development:
- An Xbox 360 DLL is written as usual.
- A relocation address must be provided manually:
- See library Project Properties - Xbox 360 Image conversion - Base Address.
- Available address range: 0x06000000 to 0x08000000.
- Compiled libraries are be placed in PROJECT\Assets\Plugins folder. See See Project Structure for more details.
- A library definition file must be provided (PLUGINNAME.def).
- See Mono Interop docs for marshaling details.
Examples
See “Xbox 360 - Native Plugin Example” package.
Video Playback
Full-screen video playback on the Xbox can be done using functions in the UnityEngine.X360VideoPlayer class.
- Video files must be placed in the PROJECT\Assets\StreamingAssets folder. See Project Structure for more details.
- Specify an absolute path when loading video files on the Xbox: _game:\Media\Raw_.
- Playing a video will automatically disable the gamer’s background music (see TCR 024).
- Playback is based on XMedia2 library. See the Xbox 360 SDK Documentation for details.