Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Couldn't access 2D Common's API

Discussion in '2D' started by suntabu, May 24, 2022.

  1. suntabu

    suntabu

    Joined:
    Dec 21, 2013
    Posts:
    76
    I made a Customized Atlas Tool, but the sprite editor I created is not as so good as Unity's Sprite Editor.

    So I need to access 2D common's API which is protected at the internal level.


    Currently, I changed 2D common's AssemblyInfo.cs like below: 111.png


    This way is very inconvenient when 2D common is updated by Unity.


    Could you make these API at the public level for customize editor making?
     
    EricShu likes this.
  2. EricShu

    EricShu

    Joined:
    Apr 9, 2021
    Posts:
    3
    YES We need them be public !!!
     
  3. suntabu

    suntabu

    Joined:
    Dec 21, 2013
    Posts:
    76
    bump up
     
  4. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    883
    @suntabu please do not "bump" posts without adding anything more to it.

    Could both of you let us know what you are trying to do with these APIs, so we can get a better understanding of which methods you are trying to use, and for what purpose?
     
  5. suntabu

    suntabu

    Joined:
    Dec 21, 2013
    Posts:
    76
    Sorry for the misbehaving:)

    I created an Atlas Tool with some customized features that Unity's SpriteAtlas does not support.

    But the tool's sprite editor I wrote is not as so good as Unity's sprite editor, not supporting secondary texture or sprite outline.
    Then I copied and modified 2D Common's source code for giving access to these APIs from my Atlas tool's code.

    And you guys are so working hard, 2D packages are changed very frequently. For a long time usage, I must grab these changes to the changed 2D common codes frequently, that's a nightmare.

    So please give the SpriteEditor API access to Unity's honest user. 2222.png
     
    Last edited: May 25, 2022
  6. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    883
    Could you be more specific to which methods you would like to use that are currently internal? and also adding the reason for why you need these methods.
     
  7. suntabu

    suntabu

    Joined:
    Dec 21, 2013
    Posts:
    76
    You could not see the image attached in posts, so I recorded them as below:

    These 2 classes level:
    ITexturePlatformSettingsDataProvider | The editor of custom Texture ScriptedImporter about needs to inherit it for providing data

    TexturePlatformSettingsHelper | Working with ITexturePlatformSettingsDataProvider

    These 4 methods level:
    InternalEditorBridge.GenerateOutlineFromSprite | For creating CustomTextureScriptedImporter's sprite outline

    InternalEditorBridge.CreateTemporaryDuplicate | The function 'GetReadableTexture2D' which is implemented from ITextureDataProvider needs to call it

    InternalEditorBridge.ShowSpriteEditorWindow | The editor of custom texture ScriptedImporter needs to use it open Unity's sprite editor for editing sprites

    InternalEditorBridge.ApplySpriteEditorWindow | The editor of custom texture ScriptedImporter needs to call it for saving modifications in Unity's sprite editor
     
  8. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    434
    Hi,

    Are you trying to create a custom module in Sprite Editor Window? It sounds like you are trying to create your own editing window. Is that correct?

    Or are you creating your own ScriptedImporter that you want to hook it up with the current Sprite Editor Window?
     
  9. suntabu

    suntabu

    Joined:
    Dec 21, 2013
    Posts:
    76
    Yep, I created my own ScriptedImporter and hooked it up with Unity's SpriteEditor.

    The importer import a file in my own format which contains information for supporting customized features.

    We can create an atlas in the project, then edit atlas sprites in Sprite Editor and save the atlas in myself's file format.

    At first, I created my own Sprite Editor Window for editing sprites, but the editor is not as good as Unity's Sprite Editor, missing secondary texture and sprite outline etc. So I decided to use Unity Sprite Editor instead.
     
    Last edited: May 25, 2022
  10. suntabu

    suntabu

    Joined:
    Dec 21, 2013
    Posts:
    76
    @Ted_Wikman please take a look at these APIs, really appreciate your quick response.
     
  11. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    883
    Just for your awareness, @suntabu, we have logged your feedback as something to consider for future 2D improvements, but we do not promise that it will be implemented, nor can we promise a date when this feedback might get acted upon. So if you need these APIs right now, I suggest you look into ways of accessing them with the tools you have at your disposal today.

    Thanks for the feedback!
     
  12. theforgot3n1

    theforgot3n1

    Joined:
    Sep 26, 2018
    Posts:
    188
    This would indeed be awesome! I badly need access to the 2D Custom Outline functionality since mesh type = tight is not efficient for large sprites (say > 1024 resolution). If I had access to it, I could drastically reduce the size of my Sprite atlases while not introducing too many verts and tris.