Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  3. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Feedback Making the "set" attribute of Sprite.texture accessible

Discussion in '2020.1 Beta' started by Deleted User, Jan 10, 2020.

  1. Deleted User

    Deleted User

    Guest

    Overview: Color-palette swapping and texture mapping for 2D-objects/meshes are overly complicated. Adding a set attribute will significantly simplify the process, and more importantly make it way way faster.

    "Setting" a texture is actually already possible if you use "Graphics.CopyTexture()", however it has the very undesired effect of making the change globally. Applying a texture to specific sprite, WITHOUT having to create a whole new sprite is essential. The "Sprite.SetTexture()" function can mirror the "Graphics.CopyTexture()" function if it is a texture size issue.

    Benchmarking the texture set in my own project, because I am using sprite skin, creating a new texture with color-swap take 5-10 TIMES longer than using "Graphics.CopyTexture()", but as I said, the global effect is undesired. Making the texture attribute "settable" is a natural progression which is VERY long overdue.
     
  2. Deleted User

    Deleted User

    Guest

    P.S. If the NativePtr variable of the sprite is an issue, its possible to also create a "Sprite.OverrideTextureTemp()" where a texture temporarily has "priority" over the base texture. And on deserialization (or if the texture goes missing for some reason), the base texture takes back over as the primary texture