<br />

If you have a question not found on this page, reach out using the contact
information on the [support contact page](https://developers.google.com/youtube/gaming/playables/support/contact).

This page may receive updates with frequent questions as they are received.

## General

This section includes any questions that don't fall into a specific category.

### Can I test the game in YouTube environment?

Yes - use the Developer Portal and follow the
[testing instructions](https://developers.google.com/youtube/gaming/playables/developer_portal#testing).

### My game is not rendering on Android or SDK test suite, what should I do?

When games are not rendering exclusively on Android or SDK test suite, it is
often caused by how games are loaded in the WebView. For performance reasons,
the game is initially loaded in a WebView that is not displayed to the user,
resulting in the WebView viewport size being zero. To resolve this issue, the
following solution is recommended:

(1) Verify that your game code executes regardless of the viewport size.

(2) Verify that your game code handles viewport resizing and that the game code
doesn't wait or fail when the viewport size is zero.

Our recommendation is to listen for the window event `resize` and set your
game's height only when window.innerHeight is non-zero.

## Technical Requirements

This section includes questions related to the YouTube Playables technical
requirements.

### Can I receive an exemption for the individual file size limit?

No. The [individual file size](https://developers.google.com/youtube/gaming/playables/certification/requirements_stability#individual_file_size) is a hard limit.

### How is initial bundle size measured?

Initial bundle size is measured as the total amount of bytes downloaded by the
Playable until the [gameReady](https://developers.google.com/youtube/gaming/playables/reference/sdk#gameready) event is called.

Playables use [HTTP compression](https://developer.mozilla.org/docs/Web/HTTP/Compression) when possible, meaning
that the initial bundle size may be smaller than the total raw size of the
assets. When testing the initial bundle size in the
[SDK Test Suite](https://developers.google.com/youtube/gaming/playables/reference/test_suite_guide), if your local host is not compressing
assets, it may result in a larger size than what will happen once your Playable
is published. To see the actual initial bundle size served for a Playable, use
the [SDK Test Suite](https://developers.google.com/youtube/gaming/playables/reference/test_suite_guide) pointed at the index.html file from an
[uploaded build](https://developers.google.com/youtube/gaming/playables/developer_portal#testing) or modify your local server settings to
enable gzip compression.

### I am at or over the individual file or total bundle size limit, what should I do?

To optimize your game and improve performance, see the following articles:

- [Image compression](https://squoosh.app/)
- [Performance audits](https://developer.chrome.com/docs/lighthouse/performance/)
- [Fast load times](https://web.dev/explore/fast)
- [Enable text compression](https://developer.chrome.com/docs/lighthouse/performance/uses-text-compression/)
  \*

  [Optimizing Encoding and Transfer Size of Text-Based Assets](https://web.dev/articles/optimizing-content-efficiency-optimize-encoding-and-transfer)
- [Minify JavaScript](https://developer.chrome.com/docs/lighthouse/performance/unminified-javascript/)

### What if I can't fit within the total bundle size limit?

Users may have to download assets from your game every time they play your game.
To prevent long loading times and large amounts of data usage, it is recommended
that the game's total bundle size be as small as possible.

We encourage games to utilize lazy loading or other types of incremental asset
loading during each play session as users progress, or break up assets per level
to allow assets to be downloaded in small amounts spread out over the course of
a long session. In situations like these, having a larger total bundle size may
not degrade the user experience, and may in fact create a better user experience
by enabling more content in your game with a lower per user footprint. If you
feel your game works in this way and justifies having a larger total bundle
size, reach out using our [support contact page](https://developers.google.com/youtube/gaming/playables/support/contact) to discuss your use case.

### Can my internal analytics be excluded from the external call requirements?

No. Playables must not make any [external calls](https://developers.google.com/youtube/gaming/playables/certification/requirements_privacydata#external_calls) at
this time. Let your partner manager know about the kind of analytics that you
are interested in so that future features in this space can be prioritized.

### The game fetches data and levels from a remote database, is this acceptable?

At this time no, however we are piloting remote data access with select titles.
Today, all game data must be included as part of the game bundle. If you would
like to update or refresh your game assets or content, reach out using the
contact information on the [support contact page](https://developers.google.com/youtube/gaming/playables/support/contact) to submit a refreshed game
bundle or reach out to inquire further if you would like to be considered for
our pilot program.

### I see an error about violating "Content Security Policy" for executing inline scripts

This happens when you use JavaScript to create and add a `<script>` tag to your
page. For security, YouTube uses a Content Security Policy (CSP) that requires
scripts to have a special security code called a "nonce". YouTube automatically
adds this code to the scripts in your HTML file, but you must manually add it to
any scripts you create with code.

When generating script tags programmatically using JavaScript, you need to
find the nonce from your page and apply it to your new script element.

Example:

    const script = document.createElement('script');
    script.src = '...';
    // Find the nonce from the main page and apply it
    script.nonce = document.querySelector('script[nonce]')?.nonce;
    document.head.appendChild(script);

You can test offline configurations using guidelines specified inside the
[test suite instructions](https://developers.google.com/youtube/gaming/playables/reference/test_suite_guide).

## SDK Integration

This section includes any questions that relate to any of the [Playables SDK
APIs](https://developers.google.com/youtube/gaming/playables/reference/sdk).

### I failed certification due to audio integration issues, what do I need to fix?

The most common audio issue that is seen involves games that are expecting user
interaction before starting playback. However, YouTube Playables may be given
focus automatically, so the game must handle this case.

For an audio setup example, check out the [samples](https://developers.google.com/youtube/gaming/playables/samples/oss_samples).

## Unity

> [!NOTE]
> **Note:** Many of the items in this section around precompression apply to Godot as well as both engines use `.wasm`, which can become large if your game does not break up its content.

This section includes any questions regarding integrating existing Unity games
with the YouTube Playables SDK. For examples on how to use the SDK and Unity
Wrapper, see the [YouTube Playables Unity
Wrapper](https://developers.google.com/youtube/gaming/playables/samples/unity_wrapper) documentation.

### Can I use Unity precompression?

We don't suggest pre-compressing your assets. Initial bundle size requirement
uses the post compression size and files uploaded will have compression applied
after ingestion. If there is still a need to precompress files see the rest of
this section or reach out to the support team at our [support contact page](https://developers.google.com/youtube/gaming/playables/support/contact) to
discuss the best option for your game.

Some games will need to use precompression for Unity's `.wasm` or `.data` files.
Only use precompression in the following conditions as this may lead to much
slower load times:

- If you need to use Unity precompression to meet individual [file size](https://developers.google.com/youtube/gaming/playables/certification/requirements_stability#individual_file_size) or [total bundle size](https://developers.google.com/youtube/gaming/playables/certification/requirements_stability#total_bundle_size) requirements, see ["I am at or over the individual file or total bundle size limit, what
  should I do?"](https://developers.google.com/youtube/gaming/playables/support/certification_faq#over-bundle-size).
- If you need to use Unity precompression for your game to pass certification, the following requirements must be met:
  1. You MUST use zip precompression.
  2. You MUST decompress the files manually within your loader script. We recommend using the Compression Streams API.

> [!NOTE]
> **Note:** A template for Unity WebGL builds is provided with the [Unity Sample
> game](https://developers.google.com/youtube/gaming/playables/samples/unity_wrapper), see `GoogleYTGameWrapper-with-sample.unitypackage` Unity Package and `WebGLTemplates/YTGameWrapperTemplate/` folders. Instructions on how to use this with zipped `.wasm` and `.data` files can be found in the [Unity
> Wrapper documentation](https://developers.google.com/youtube/gaming/playables/samples/unity_wrapper).

> [!NOTE]
> **Note:** Verify that your game does not take a considerably long time to load as using these workarounds may cause your game to load slowly.

These additional requirements stem from limitations of the serving architecture.
At this time, support for additional HTTP headers or Brotli compression is not
available.

### How can I manage frame updates when the game is running in the background?

You can use `setTimeout` to manage frame updates when the game is backgrounded.
This helps control behaviors such as pausing audio. You can verify background
frame management by enabling the "Run in Background" option in the player
settings.

### Memory restrictions for Unity games

Some games in Unity will use a substantial amount of memory which can lead to
exceeding the [memory usage restrictions](https://developers.google.com/youtube/gaming/playables/support/faq#memory-usage-restrictions) for playables. It is recommended to
follow the development documentation for [Memory in Unity WebGL](https://docs.unity3d.com/Manual/webgl-memory.html).