File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11mergeInto ( LibraryManager . library , {
22 OnScreenshotTaken : function ( strPtr ) {
3- const base64str = UTF8ToString ( strPtr ) ;
4- window . parent . postMessage (
3+ const base64str = UTF8ToString ( strPtr )
4+ const targetWindow = ( ( ) => {
5+ try {
6+ return window . self !== window . top ? window : window . parent
7+ } catch ( e ) {
8+ return window . parent
9+ }
10+ } ) ( )
11+ targetWindow . postMessage (
512 {
6- type : 'unity-screenshot' ,
7- data : base64str
13+ type : 'unity-renderer' ,
14+ payload : {
15+ type : 'screenshot' ,
16+ payload : base64str ,
17+ } ,
818 } ,
919 '*'
10- ) ;
11- }
12- } ) ;
20+ )
21+ } ,
22+ OnLoadComplete : function ( ) {
23+ const targetWindow = ( ( ) => {
24+ try {
25+ return window . self !== window . top ? window : window . parent
26+ } catch ( e ) {
27+ return window . parent
28+ }
29+ } ) ( )
30+ targetWindow . postMessage (
31+ {
32+ type : 'unity-renderer' ,
33+ payload : {
34+ type : 'loaded' ,
35+ payload : true ,
36+ } ,
37+ } ,
38+ '*'
39+ )
40+ } ,
41+ } )
Original file line number Diff line number Diff line change 33using System . Linq ;
44using System . Text ;
55using System . Threading . Tasks ;
6+ using System . Runtime . InteropServices ;
67using Data ;
78using GLTF ;
89using JetBrains . Annotations ;
@@ -33,6 +34,9 @@ public class PreviewLoader : MonoBehaviour
3334 public bool HasEmoteAudio => _emoteAudio != null ;
3435 public bool HasWearableOverride => _overrideWearableCategory != null && ! HasEmoteOverride ;
3536
37+ [ DllImport ( "__Internal" ) ]
38+ private static extern void OnLoadComplete ( ) ;
39+
3640 public async Awaitable LoadPreview ( PreviewConfiguration config )
3741 {
3842 gameObject . SetActive ( false ) ;
@@ -211,6 +215,8 @@ await Task.WhenAll(wearableDefinitions
211215 }
212216
213217 Debug . Log ( "Loaded all wearables!" ) ;
218+
219+ OnLoadComplete ( ) ;
214220 }
215221
216222 private void SetupFacialFeatures ( GameObject bodyGO )
You can’t perform that action at this time.
0 commit comments