Download Images and show them dynamically
Posted: 26 Aug 2021, 17:39
Hi,
we need to download custom changed jpeg&pngs at runtime, store them locally on the device and show them by code.
I get problems with the last point:
- File.Exist(filename) is true.
- my noesis demo app, running with visual studio without unity has no problems. Images appeared.
Problems starts when running in unity playmode and on my android device:
[noesis] Image not found '../../Resources/Images/Fundort.png'
UnityEngine.Debug:LogError (object,UnityEngine.Object)
NoesisUnity:UnityLog (int,string) (at C:/Users/Thies/Downloads/NoesisGUI-Unity-3.1.0/Runtime/NoesisUnity.cs:288)
Noesis.BitmapImage:set_UriSource (System.Uri) (at C:/Users/Thies/Downloads/NoesisGUI-Unity-3.1.0/Runtime/API/Proxies/BitmapImage.cs:51)
Noesis.BitmapImage:.ctor (System.Uri) (at C:/Users/Thies/Downloads/NoesisGUI-Unity-3.1.0/Runtime/API/Proxies/BitmapImage.cs:31)
Can you please help me, telling me, what I doing wrong?
My code is simple as it could be:
xaml:
c#:
Kind regards and thanks for your help!
Thies
PS: Using Unity 2020.3.16f1 and noesis 3.1
we need to download custom changed jpeg&pngs at runtime, store them locally on the device and show them by code.
I get problems with the last point:
- File.Exist(filename) is true.
- my noesis demo app, running with visual studio without unity has no problems. Images appeared.
Problems starts when running in unity playmode and on my android device:
[noesis] Image not found '../../Resources/Images/Fundort.png'
UnityEngine.Debug:LogError (object,UnityEngine.Object)
NoesisUnity:UnityLog (int,string) (at C:/Users/Thies/Downloads/NoesisGUI-Unity-3.1.0/Runtime/NoesisUnity.cs:288)
Noesis.BitmapImage:set_UriSource (System.Uri) (at C:/Users/Thies/Downloads/NoesisGUI-Unity-3.1.0/Runtime/API/Proxies/BitmapImage.cs:51)
Noesis.BitmapImage:.ctor (System.Uri) (at C:/Users/Thies/Downloads/NoesisGUI-Unity-3.1.0/Runtime/API/Proxies/BitmapImage.cs:31)
Can you please help me, telling me, what I doing wrong?
My code is simple as it could be:
xaml:
Code: Select all
<Image x:Name="m_Img" />
Code: Select all
if (File.Exists(imageData.FilePath)) // <= is true
{
System.Uri fileUri = new System.Uri(imageData.FilePath);
m_Img.Source = new BitmapImage(fileUri); // <= no exception, but Unity throws a message log
}
Kind regards and thanks for your help!
Thies
PS: Using Unity 2020.3.16f1 and noesis 3.1