I'm working with Unity(+Vuforia), and I'm having some problems trying to print some variables that I want to identify the vuMark Augmented Reality Object (this a Vuforia thing) with, but I can't seem to get it to work.
My code is below, where I want the vuMarkID to be compared to "Table". In the DebugLog, however, my second statement (Debug.Log("vuMarkCompareToTable...")
) returns 1. Even though the first statement (Debug.Log("ID = {0}"...)
) returns "Table". I have tried trimming the vuMarkID string object, and also tried converting it directly, as you see below.
The other strange thing is nothing will print after "Table" in the debug log, for the first statement. I've tried concatenating using something like vuMarkID+"END"
, and the statement just cuts off at "Table". I've even tried printing using "ID = {0}{0}"
, and only the first "Table" prints. Even if the vuMarkID object changes (for instance, to Stool), it still does not print anything after the initial vuMarkID object.
How can I get the Debug.Log to recognize text after "Table" and have the CompareTo function return 0 when the arguments are (seemingly) the same?
Edit: I tried Debug.Log(string.Format("ID = " + vuMarkID + "DONE"));
as well (I'm trying to see if there's something after the text), but that also cuts off immediately after the vuMarkID. I tried replacing for newline, just in case it was there, but it didn't have an effect.
//Gets the id of a VuMark Object
string vuMarkID = GetVuMarkId(vuMarkObj).ToString();
if (vuMarkID.CompareTo("Table ") == 0)
{
Debug.Log("Table found from tracking!");
}
else
{
string logdebug = vuMarkID;
object[] args = new object[] { (vuMarkID), vuMarkID.CompareTo("Table") };
Debug.Log(string.Format("ID = {0}", logdebug));
Debug.Log("vuMarkCompareToTable = " + (vuMarkID.Trim().CompareTo("Table")));
}
Exception in callback: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
– A4Treok