#probably, try keep the decal cached

1 messages ยท Page 1 of 1 (latest)

elder rover
#

how can I ask TTS to cache decal resource?

marble sedge
#

keep the decal cached somewhere else

elder rover
#

ah, sorry. I see what you mean. Yes, that works, thanks!
Is it the only possible way?

marble sedge
#

you can keep a cache in all kinds of places

#

I tend to use Global UI as my "dumping ground" for cached images

#

as it is loaded before all objects

elder rover
#

okay, I didn't realise that TTS may be reusing same cache both for UI and decals. I'll look into it. Thank you!

marble sedge
#

it caches by sanitised filepath/url

#

just adding the file to assets isn't enough, it has to be draw on the xml

#

so you can draw a 1x1 image off-screen for it:

<Image width="1" height="1" image="myCustomAssetName" rectAlignment="UpperLeft" offsetXY="-100 -100"/>
#

I believe you can use absolute filepaths too, which avoids cluttering up your customassets list

elder rover
#

so can I consider this a sane approach for this? ๐Ÿ™‚

marble sedge
#

yes

#

just bear in mind that scripts are run after objects are loaded and decals are applied

#

it doesn't really matter in your use-case, all that matters is that somewhere a reference remains so the cache remains alive

elder rover
#

Okay, thank you once again. That was very helpful!

#

Hmm... That doesn't seem to work. This huge red thing on the background is the same red decal that is rendered on figurine. And it is still displays white square. Note that for green decal it is working fine probably because I already have figurine with same decal nearby.
I guess, I'll just have to store decal data in tiny decals instead of tiny UIs. ๐Ÿ™‚

marble sedge
#

I don't see a white square at all in your video

elder rover
#

oh, funny thing. It is preciselly skipped on video. Probably because TTS is running in 144fps while video is in 60.

#

Trust me, it is still present ๐Ÿ™‚

marble sedge
#

I encourage you to use xml instead then

#

that way you can set active to false/true on each image element

#

without re-drawing

elder rover
marble sedge
#

I encourage you to use xml instead then

elder rover
#

I mean, I'm already doing it.

#

yep, after I replaced caching via Images in XML UI with actual duplicated decals, there isn't a single frame delay. It seems like XML UI chaching really helps, but it still have 1 frame flashing (instead of couple of them as it was before). Like http-level cache and dynamic unity-material cache or something like that.

marble sedge
#

you misunderstand

#

I meant use xml for showing the image and not using decals at all

elder rover
#

Ah, I see what you mean.
It seems like a better solution in general case, but I specifically would prefer using decals instead since those tokens should be external to any board-game I play and I don't really want to mess up UI on item if it is already present there.
Next time I'll try that for sure.