Forum

You need to log in to create posts and topics.

HtmlUIPanel not updating properly?

Hello!

I've been trying out PowerUI due to the need to display HTML formatted text in Unity (e.g. text from https://summernote.org/), using data pulled from a server. As a result, I've been relying on HtmlUIPanel.

The aim is to replace the HtmlUIPanel with new data (string), so we can display a variety of things.

However, I ran into an issue where HtmlUIPanel wasn't being updated properly (still showing older content). Typically, I would update the contents like this, with the aim of clearing the older content, writing the drag scroller code in then finally the htmlText.

rawImage.GetComponent<HtmlUIPanel>().document.clear();
rawImage.GetComponent<HtmlUIPanel>().document.write(initialScroll);
rawImage.GetComponent<HtmlUIPanel>().document.write(htmlText);
rawImage.GetComponent<HtmlUIPanel>().document.write(endScroll);

Here's a sample of what happens, with the left window being the scene view and the right window being the game view. The desired display is selected on the left window (below the two "OnAUnityUI" images)

Am I missing out something important to make this work?

I managed to fix the issue!

It turns out that I messed up the execution order, whereby the Pop Up containing the HtmlUIPanel was inactive when I modified the document. (It was actually modifying an older version of the HtmlContent, rather than the current one!)

Hence, I made the Pop Up active first, then modified the document, which led to the intended result of modifying the current HtmlContent, which is being shown in the Pop Up.

Also, special thanks to Luke for helping out via email! I'm going to leave this thread up in case anyone encounters a similar issue.

Want the latest updates? Check out the repositories.