|
|
|
|
|
|
|
|
|
|
First of all, please open or create a Unity Project and open it with Unity Editor. |
|
|
|
|
|
|
|
And then open Project Settings, go to Player section and add "UIWidgets_DEBUG" to the Scripting Debug Symbols field. |
|
|
|
This enables the debug mode of UIWidgets for your development. Remove this for your release build afterwards. |
|
|
|
|
|
|
|
#### ii. Scene Build |
|
|
|
A UIWidgets App is usually built upon a Unity UI Canvas. Please follow the steps to create a |
|
|
|
UI Canvas in Unity. |
|
|
|
|
|
|
|
|
|
|
namespace UIWidgetsSample { |
|
|
|
public class ExampleCanvas : WidgetCanvas { |
|
|
|
protected override void OnEnable() { |
|
|
|
base.OnEnable(); |
|
|
|
|
|
|
|
// Application.targetFrameRate = 60; // or higher if you want a smoother scrolling experience. |
|
|
|
|
|
|
|
// if you want to use your own font or font icons. |
|
|
|
// use the font family name instead of the file name in FontStyle.fontFamily. |
|
|
|
// you can get the font family name by clicking the font file and check its Inspector. |
|
|
|
// FontManager.instance.addFont(Resources.Load<Font>(path: "path to your font")); |
|
|
|
} |
|
|
|
|
|
|
|
protected override Widget getWidget() { |
|
|
|
return new ExampleApp(); |
|
|
|
} |
|
|
|
|
|
|
1. Choose a target platform and click "Build". Then the Unity Editor will automatically assemble |
|
|
|
all relevant resources and generate the final App package. |
|
|
|
|
|
|
|
#### How to load images? |
|
|
|
1. Put your images files in Resources folder. e.g. image1.png. |
|
|
|
2. You can add image1@2.png and image1@3.png in the same folder to support HD screens. |
|
|
|
3. Use Image.asset("image1") to load the image. Note: as in Unity, ".png" is not needed. |
|
|
|
|
|
|
|
UIWidgets supports Gif as well! |
|
|
|
1. Suppose you have loading1.gif. Rename it to loading1.gif.bytes and copy it to Resources folder. |
|
|
|
2. You can add loading1@2.gif.bytes and loading1@3.gif.bytes in the same folder to support HD screens. |
|
|
|
3. Use Image.asset("loading1.gif") to load the gif images. |
|
|
|
|
|
|
|
## Debug UIWidgets Application |
|
|
|
|
|
|
|