Log in or register to post comments

Vumark string value filled with string terminator characters

January 12, 2017 - 7:56am #4

Hello!

 

I am using Vumarks in Unity and I came across a weird problem. I created a Vumark template which encodes a string of length up to 50.

 

When I see a Vumark on camera and read its string value (vumark.InstanceId.StringValue) I get the following string:

 

"MyVumarkText\0\0\0\0\0...\0"

 

Since the text in the printed Vumark is not of length 50, but less, the remaining characters are all set to '\0' or the string terminator character. Is this a bug?

 

It took a while to figure it out because usually string terminator characters are not printed when you print a string. I used the value inside the vumark and compared it with some other data in my program and it resulted in "MyVumarkText" == "MyVumarkText" is false (since you can't see the terminator characters). Which is why it was very confusing to figure out.

 

I will update if I find something else weird with the string values of Vumarks.

Vumark string value filled with string terminator characters

January 20, 2017 - 9:34am #3

Hello,

Thanks for the report. We'll investigate further.

Thanks.

Vumark string value filled with string terminator characters

October 5, 2017 - 8:48pm #2

Hi,

This bug still alive!

Vumark string value filled with string terminator characters

February 1, 2018 - 1:10am #1

Hi,

Can we get this bumped up please?

I stumbled across this problem when trying to determine which GameObjects to render by a string comparison. I've found that VuMarkTarget.InstanceId.ToString().length is always equal to the ID Length attribute of the VuMarkBehaviour, irrespective of the character count used when generating the VuMark instance in the Target Manager.

For example:

- I create a VuMark with ID Length of 6 (from the documentation said to mean the maximum number of characters that can be included in an ID)

- I import into Unity (2017.3.0f3 for reference)

- I generate an instance in the Target Manager with ID "L"

- I create custom behaviour on the DefaultTrackableEventHandler included in the SDK files that reads something like:

//markId is equal to VuMarkBehaviour.VuMarkTarget.InstanceId.ToString()

if (markId == "L") {

    //Do something

}

This scenario will never be true because the tracked ID will be "L" + five further hidden characters to make it up to the 6 required by the ID Length aforementioned. These characters I presume, are the terminator characters detailed below.

This is problematic because it requires that I always use the same number of characters in my IDs as the original length, and restricts me from generating IDs that make the most sense to what they represent.

I've not yet checked if this is the case with the numeric or byte ID Types.

EDIT: Having checked for terminator characters using the InstanceId.StringValue method below, I see that the terminator characters no longer appear in the output, but the underlying issue still exists, because my IDs are matching my comparison strings, and StringValue.Length still always equals the ID Length irrespective of characters used in the ID.

 

Log in or register to post comments