Open gardyna opened 8 months ago
Hello @gardyna, thanks a lot for the suggestion! Sorry for the long reply, I was busy on other projects. I will implement the API for this feature in the next versions.
I have a situation where I have to choose between several lottie files at runtime to display. I don't think having several gameobjects in the scene and selecting between those is elegant. Would it be possible to add a "SetLottie" function to the AnimatedImage object?
This would be very useful.
Hey @gardyna and @JonFaull I just reviewed again the existing implementation.
The AnimatedImage monobeh does has a public method LoadFromAnimationJson()
You can use it on the same AnimatedImage instance to load new animations. It will automatically unload the already loaded animation. No need to dispose it explicitly.
You need to provide at least 3 parameters:
string json, uint width, uint height
You can see an example how to use this method on the dev branch in the repo_root/unity/RLottieUnity/Assets/LottiePlugin/Tests/Runtime/src/AnimatedImageTests.cs
file
I have a situation where I have to choose between several lottie files at runtime to display. I don't think having several gameobjects in the scene and selecting between those is elegant. Would it be possible to add a "SetLottie" function to the AnimatedImage object?