Search Unity

Resolved Textures settings are ignored

Discussion in 'Dedicated Server' started by creat327, May 16, 2023.

  1. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    I hit build for my Dedicated Server and I get a 411mb folder. I checked, and all my Resources folder is in there.

    This seems ok, they are resources and there is no way for the Editor to know if i'm loading them at runtime. My issue is that I have a large amount of textures that I don't need on a dedicated server.

    Since there is no option to enable/disable resources depending on the build type. My trick was to "Override for Dedicated Server" the texture settings and set the size to 32x32. This way all textures would be in the 1kb to 2kb size.

    Well, to my surprise, that setting gets ignored on Dedicated Server. It works just fine for any other platform, but on dedicated server my texture sizes are still HUGE even after setting them to tiny sizes.

    Unity 2022.2 here.
     
  2. Frigider

    Frigider

    Joined:
    Mar 8, 2021
    Posts:
    1
    I'm also having the same problem, I found that the texture compression is completely ignored.
     
  3. cristianm_unity

    cristianm_unity

    Unity Technologies

    Joined:
    Oct 16, 2018
    Posts:
    259
    Hey! I'll have a look at the texture overrides on Dedicated Server, that sounds like a bug.
    In the meantime, could you please confirm if your textures have the "read/write" option on? Dedicated Server should strip the textures data where that "read/write" option is off.
     
  4. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    read-write is off, but i thought they would get copied because they are in the Resources folder anyway. They shouldn't?
     
  5. cristianm_unity

    cristianm_unity

    Unity Technologies

    Joined:
    Oct 16, 2018
    Posts:
    259
    yeah, they are copied. But in Dedicated Server, textures with read/write off will contain no pixel data.

    This means that the metadata of the textures is preserved, if you access the texture size you will get the original value, but the actual data is removed, and if you try to access the pixel colors you'll get an error.

    However, for what you mention this optimization might not apply to the Resources folder.
     
  6. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    ok, well, right now the most urgent issue is that the compression and texture settings are completely ignored. I set it to 32x32 and it is still 4096x4096 when i hit run or build.
     
  7. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    any updates on this?
     
  8. cristianm_unity

    cristianm_unity

    Unity Technologies

    Joined:
    Oct 16, 2018
    Posts:
    259
    Hey! We're still in the process of investigating this issue. I estimate it could take a couple weeks.
    In the mean time, I'm curious about your case, why is it necessary to use the Resources folder?
     
  9. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    Because I dynamically load into memory different assets depending on player decisions. Those assets must be included in the build. For the server I could remove the textures but then i would need to keep separate source code versions of the folders. I would expect the server just to ignore those when building or at the bare minimum take the texture settings into account. Otherwise, why do we even have the texture settings for?
     
  10. cristianm_unity

    cristianm_unity

    Unity Technologies

    Joined:
    Oct 16, 2018
    Posts:
    259
    Hey! So I've been investigating this and I can confirm that there is an issue with the texture override options for the Dedicated Server target (correction: it works, see next message).

    However, I also verified the "Read/Write" option and in this case it seems to be working correctly. What it does is to strip all the pixel data for textures that are not marked as "Read/Write" meaning that their metadata is preserved but the actual size of the textures in the build is very small. In my case, all those textures were reported to be only 128 Bytes in the build (I'm using the Build Report Inspector to check it), even for the textures in the Resources folder.

    So could you please confirm what is the reported size of the textures that are not marked as Read/Write for your project?
     
  11. cristianm_unity

    cristianm_unity

    Unity Technologies

    Joined:
    Oct 16, 2018
    Posts:
    259
    I have to correct my previous message, the override option is actually working properly for my test. I just forgot to hit the "Apply Overrides" button.

    upload_2023-7-10_15-8-48.png

    In any case, keeping the "Read/Write" option off for textures in Dedicated Server will always produce smaller builds. So please let me know your results to verify and see if there is anything else we should investigate.

    Cheers!
     
  12. cristianm_unity

    cristianm_unity

    Unity Technologies

    Joined:
    Oct 16, 2018
    Posts:
    259
    Ok, new findings: The texture overrides work when it is applied to the entire project (build window) but does not work if it is set in a per asset basis.
     
    MikeHergaarden likes this.
  13. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    I've hit the same bug, is this already being worked on or do we need a bugreport?
     
  14. cristianm_unity

    cristianm_unity

    Unity Technologies

    Joined:
    Oct 16, 2018
    Posts:
    259
    Hey! so we reviewed the textures stripping and fixed some issues we found specially with texture arrays.

    In 2021.3, 2022.3 and 2023.3 you should be able to uncheck the read/write flag of your textures and the pixel data is going to be stripped for Dedicated Server builds. Meaning that you'd only export the metadata (a few bytes per texture) to the Dedicated Server build.

    Let us know if you still see issues so we can review them.
    Cheers!!