Unity-Technologies / com.unity.uiwidgets

UIWidgets is a Unity Package which helps developers to create, debug and deploy efficient, cross-platform Apps.
https://unity.cn/uiwidgets
626 stars 78 forks source link

add support for absolute image path #316

Closed zhuxingwei closed 2 years ago

zhuxingwei commented 2 years ago

In this PR, we add the support that, users can now load local image from an absolute path as suggested in #314

In this solution (we might still need to seek for another better solution?), we add an extra parameter isAbsolutePath to bothImage.file and the ctor of FileImage: If the parameter is true, we won't process the path as we do before (when we assume that all local image file paths are prefixed by the streamingAssets path) and try to load the image from the original path directly.

Note that in this solution, once the user pass in the absolute path of the image, he/she is also responsible to deal with the platform-dependent issues.

We also change the ImageTest sample a bit to show a basic use case.