Skip to content

Conversation

nitz
Copy link

@nitz nitz commented Nov 16, 2021

HexPropertyDrawer will draw an integer type decorated with [Hex] represented as a hexadecimal string. The user can modify the hex value and it will re-serialize as expected. If the 0x is removed from the field, or the user enters a decimal number, that number will be serialized as decimal, but still displayed as hexadecimal.

HexAttribute allows a manual setting of a minimum display width, adjusting how many potential 0s the hexadecimal string is padded with. By default, the the minimum width will be automatically determined based on the type of the field.

Added to readme, example code:

public class NaughtyComponent : MonoBehaviour
{
	[Hex]
	public int myHexValue = 0x1234;
	[Hex]
	public int myIntValue = 1234;
}

Produces:

Hex_Inspector

nitz added 2 commits November 16, 2021 08:58
`HexPropertyDrawer` will draw an integer type decorated with `[Hex]` represented as a hexadecimal string. The user can modify the hex value and it will re-serialize as expected. If the `0x` is removed from the field, or the user enters a decimal number, that number will be serialized as decimal, but still displayed as hexadecimal.

`HexAttribute` allows a manual setting of a minimum display width, adjusting how many potential 0s the hexadecimal string is padded with. By default, the the minimum width will be automatically determined based on the type of the field.
@nitz nitz changed the title Add hex Add HexAttribute Nov 16, 2021
@nitz
Copy link
Author

nitz commented Jun 14, 2022

Updated this PR to not conflict with base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant