Skip to content
This repository has been archived by the owner on Jan 4, 2022. It is now read-only.

Support numerical data types to count digits #54

Open
1 of 4 tasks
psuong opened this issue May 25, 2020 · 1 comment
Open
1 of 4 tasks

Support numerical data types to count digits #54

psuong opened this issue May 25, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@psuong
Copy link
Member

psuong commented May 25, 2020

Right now text is represented as unicode characters in a DynamicBuffer<CharElement>(). One way to copy a string to the DynamicBuffer is to do the following:

fixed(char* ptr = "some_string") {
  UnsafeUtility.MemCpy(destination_buffer, ptr, "some_string".Length);
}

The problem is that it still uses the string class. As an alternative I've started to write some utility functions to store the character elements into a ptr and length that you pass into it.

public static void ToCharArray(this int value, char* ptr, in int length, out int count) 

TODO

  • Add support for floating points
  • Add support for Unity's FixedString data structures
  • Add support to copy from the ptr to the DynamicBuffer<CharElement>()
  • Add support to copy from a FixedString to the DynamicBuffer<CharElement>()
@psuong psuong added the enhancement New feature or request label May 25, 2020
@psuong psuong self-assigned this May 25, 2020
@psuong
Copy link
Member Author

psuong commented Dec 15, 2020

Referring to this post I put here as I try to figure things out: #66

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
UGUIDots Development
  
Awaiting triage
Development

No branches or pull requests

1 participant