2013年9月5日 星期四

[Unity] Read/Write Enabled

Unity匯入的Asset中,Texture與Model的Import Settings裡都會有Read/Write Enabled的選項,這個選項的作用是:
  • Texture:
    • Select this to enable access to the texture data from scripts (GetPixels, SetPixels and other Texture2D functions). Note however that a copy of the texture data will be made, doubling the amount of memory required for texture asset. Use only if absolutely necessary. This is only valid for uncompressed and DTX compressed textures, other types of compressed textures cannot be read from. Disabled by default.
    • 當有scripts會從Texture存取texture data時,會需要勾選Read/Write Enabled,但這個選項會使Unity需要一份額外的copy,增加記憶體的消耗。此選項預設是關閉的,也只適用於未壓縮或DXT貼圖格式的貼圖。
  • Model:
    • Enables the mesh to be written at runtime so you can modify the data; it makes a copy in memory. When this option is turned off, it saves memory since Unity can unload a copy of mesh data in the game. However, if you are scaling or instantiating meshes at runtime with a non-uniform scale, you may have to enable "Read/Write Enabled" in their import settings. The reason is that non-uniform scaling requires the mesh data to be kept in memory. Normally this is detected at build time, but when meshes are scaled or instantiated at runtime you need to set this manually. Otherwise they might not be rendered in game builds correctly.
    • 當你需要Runtime修改Model資料時,會需要開啟Read/Write Enabled,同樣會需要一份額外的記憶體消耗,而值得注意的是當Model在Runtime有被做非等比縮放時,也會需要開啟此選項。
    • 使用Mesh Combine...功能時需要開啟Read/Write Enabled。
參考資料
參考文章

沒有留言:

張貼留言