- Home /
Adding custom functionality to 2D texture import settings -- where to start?
Hello. I have a fairly specific need for my game but I have no experience coding editor extensions or custom inspector tabs so I am not sure how to best tackle the problem. I will explain what I want to accomplish and hopefully somebody can recommend a good way of going about it.
I have many 2D sprites in my game. Here is an example:
For each of these sprites, I would like to attach information (four integers to be precise) which would describe a 2D rectangle relative to the imported sprite's pivot point. The 'Texture Type' of the import is "Sprite (2D and UI)".
Ideally, I would like to be able to edit and save this rectangle information from the Unity editor (much like you can edit and assign a sprite 'Border' from the Sprite Editor. Here's what it might look like as an extension to the Sprite Editor (my custom rectangle bounds shown in red):
Does anyone know how to go about adding some functionality like this to the Unity editor? And keep in mind that these rectangles are not for collision -- so I will not ever be creating a gameobject that could use the collision box editor
As of writing this I am struck by the simple hack of just repurposing the Border field for my use in this instance...
But since I still want to know how somebody would go about doing this the real way, let's assume that I need to be able to define a whole list of rectangles.