66
Грабли Unity3D Алексей Чубарь BIT.GAMES (Пенза) на примере Гильдии Героев

SECON'2016. Чубарь Алексей, Мобильные грабли Unity

  • Upload
    secon

  • View
    152

  • Download
    10

Embed Size (px)

Citation preview

PowerPoint

Unity3D BIT.GAMES ()

? Unity3D? . . Unity3D .

? Unity3D? . . Unity3D .

Brace yourselves

Technical mumbo-jumbo is coming

:

Web-browsersFlash/Action ScriptiOS, AndroidOpenGL ES/C++

: RPG

2D

Unity?

Unity?

Unity?

Unity?

Unity?

Unity?

Unity?

Unity?

Unity?

++

, . C++ .

. .

. : DLC...

- ...

. . .

- ... ... .

Asset Store ./. . ?

Asset Store:

Asset Store: . . .

1.2.3.

Asset Store: . Editor/PostProcessBuildPlayer*. PostProcessBuild (PostProcessBuildAttribute) , . , .

Asset Store: ,

Asset Store: . - .

Asset Store: Android

UserProfile.javaMainActivity.java

economics.jar.class.classclasses.dex

classes.dexGame.apkN methodsM methodsK methodsS = N + M + K + ...S < 63000: OK.S > 65536: APK Unity.63000 < S Capacity?True,alloc fallback onceFalse,no allocs

runtime: Garbage collection . :foreach;using;Array.IndexOf ..;Excessive + strings + concat; .

runtime: Garbage collection

Boxing Boxing C#-struct Entry : IPrintable

Thread stackvar e1 = new Entry();EntryManaged heapvoid MyCustomPrint(IPrintable p)

Object (boxed Entry)

IPrintable toPrint = e1;MyCustomPrint(toPrint);IPrintable ref1

runtime: . . - .

Unity call stack be like:i == 2i == 2i == 2i == -97

runtime: UnityPlayerWindZone + UnloadUnusedAssets() = UnityPlayer iOS. . WindZone.UnityPlayer? More like UnityPrayer!

runtime: JIT AOT C# codeJS codeUnityScript codeCILCILCILAssembly.dll

Sources

Script compiler

Mono runtimeJITAOT

runtime: JIT AOT C# codeJS codeUnityScript codeCILCILCILAssembly.dll

Sources

Script compiler

Mono runtimeJITAOT

runtime: JIT iOS :Generics + Reflection = butthurt;Generics + Native code = butthurt;Delegates + Native code = butthurt;... Troubleshooting on iOS devices - .

runtime: JIT iOSC# JS USCILCILCILSourcesScript compiler

Mono runtimeJITAOTdlldllC++Native binaryscripting backend: Monoscripting backend: IL2CPP

JIT ExecutionEngineException JIT DLL, , , JIT

runtime: JIT iOSChat ConnectAsync Chat Connecting - .: Scripting backend Mono ExecutionEngineException.: DLL. DLL Unity.

runtime: JIT iOSWorkaround DLL: add/remove event . . . .

: RGB ETC 4 bit, 10241024: 512KB

RGBA 32 bit, 10241024: 4MBAlpha ETC 4 bit, 512x512: 128KB

-84%

: RGB ETC 4 bit, 10241024: 512KB

RGBA 32 bit, 1024512: 2MBAlpha ETC 4 bit, 512x512: 128KB

-69%

: fillrateHigh-res background partsLower-res RenderTexture

High-DPI Device

: fillrateHigh-res background partsLower-res RenderTexture

High-DPI Device

,

: fillrate GPU ,

: depth buffer

Far Clip PlaneNear Clip Plane

: depth buffer

, .

GPU, Z-fighting.

OK! , ,

: Unity Answers . . . . .

2006:

2016:The impact of Unity Answers

: Unity Technologies . issue tracker. Unity Technologies . . - Pro- (, crash reporting).

TL;DR: Unity Unity - . - , . - .Theres a [bad] plugin for that. , . - . , . . , . , .

?