Loading Screen Customization
Explains how to customize the screen shown while Unity WebGL is loading.
Loading screen files
The loading screen exists in two places.
WebGLTemplates/AITTemplate/loading.html
SDK default template (source)
Assets/AppsInToss/loading.html
Project-specific custom loading screen
AITPackageInitializeris [InitializeOnLoad]Runs at editor startup, Assets/AppsInToss/loading.htmlIf this does not exist, it copies the SDK template. Modifying this file applies the custom loading screen.
SDK template search order:
Packages/im.toss.apps-in-toss-unity-sdk/WebGLTemplates/AITTemplate/loading.htmlPackages/com.appsintoss.miniapp/WebGLTemplates/AITTemplate/loading.htmlAssembly path-based
Build insertion order
In the build CopyWebGLToPublic() step index.htmlof %AIT_LOADING_SCREEN% placeholder is replaced with the entire contents of the loading screen.
1. Does Assets/AppsInToss/loading.html exist?
→ Yes: use the project custom loading screen
→ No: SDK default template fallback
2. If the SDK template also does not exist?
→ Debug.LogWarning("Loading screen file not found. An empty loading screen will be used.")
→ Replaced with an empty stringIn other words, the loading screen is inlined into index.html at build time. Since it is not loaded as a separate file, relative path references are interpreted relative to the final index.html base path.
Revert to the default template
AIT > Reset Loading ScreenWhen you run it, after a confirmation dialog it copies the SDK template Assets/AppsInToss/loading.htmlback over it. Custom content will be lost, so back it up first if needed.
File structure
App information
The app information shown on the loading screen is determined in the following order.
Native app environment (inside the Toss app) — the SDK
getAppsInTossGlobalsretrieves app information and overwrites itFallback (web browser, etc.) — values set in AIT Configuration are used
App name (displayName)
App name shown on the loading screen
App icon (iconUrl)
App icon URL shown on the loading screen
Primary color (primaryColor)
Progress bar color
Note: In the actual Toss app environment, native values take precedence, so the above settings are mainly visible in development and test environments.
Customizable scope
loading.htmlYou can freely modify the HTML, CSS, and JavaScript. AITLoading You can receive progress values through the API. You can represent the received values however you like.
UI design — progress bars, pie charts, circular loading indicators, etc.
Animations — CSS animations, JavaScript animations, GIFs, Lottie
Brand elements — mascot characters, logo animations
Interactive elements — mini-games, tip sliders
Using external resources
StreamingAssets (recommended) — Assets/StreamingAssetsIf placed there, it is automatically included in the build.
Data URI — small images under a few KB are inlined as Base64.
CDN — loads from an external URL. This introduces network dependency, and the loading screen itself may appear later.
AITLoading API
window.AITLoadingis index.htmldefined there, and the following six items are the entire public surface. _Members starting with _ are internal implementation details, so do not depend on them.
appInfo
{ iconUrl, displayName, primaryColor }
onReady(callback)
App info ready
onProgress(callback)
Progress update
onComplete(callback)
Loading complete
onError(callback)
Error occurred
hide()
Hide the loading screen
appInfo
The initial value is the Configuration value substituted at build time, and when native app info arrives, it is updated to that value.
onReady
Called when app info is ready. Use it to initialize the UI.
Important:
onReadyThe callback should not be assumed to be called only once. It is called once during initialization, and if native app info arrives later, it is called again with the updatedappInfovalue. Write the callback so it is safe to run multiple times (idempotent). If you register it after initialization is already complete, it is called once immediately.
onProgress
0.0from 1.0 Receives progress values between 0 and 1.
onComplete
Called when loading finishes. If you register it after completion, it is called immediately.
onError
{ message } Receives an object in the form of.
Note: Failed to create WebGL context (
GLctx,WebGL context,Unable to createseries) are handled by the SDK through a dedicated path, so they do not reach this callback. Unless you want to handle cases where the device cannot open WebGL yourself, you do not need to worry about it.
hide
#ait-loading-wrapper the element display: nonehide with.
Example
Below is a hand-written example. The SDK's actual default template (dark theme) is Assets/AppsInToss/loading.htmlSee it at
Progress bar
Percentage display and error handling
Troubleshooting
Icon not displayed
Check whether the icon URL is set in AIT Configuration
External images may be blocked by CORS policy — images from the same domain are recommended
In the native app environment, the app icon is loaded automatically, so fallback values may not appear
Custom loading screen not applied
The file
Assets/AppsInToss/loading.htmlis in that location — other paths are not recognizedThe loading screen is inlined at build time, so changes will not be reflected unless you rebuild after editing the file
Progress not updating
AITLoading.onProgress()is registeredRegister the callback early in page load — if you register it after loading has already started, you will not receive earlier progress values
appInfo is empty
AITLoading.appInfoInstead of reading it directly onReady use it inside the callback. App info initialization may not have finished yet when the script runs.
Related documents
Build pipeline —
%AIT_LOADING_SCREEN%Where substitution happensBuild customization — modifying the web entry point outside the loading screen
Get started — app info settings
Troubleshooting — across build and runtime
Was this helpful?