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. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    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