x


Char class issues

Ey I'm getting a lot of problems trying to use an Array. I got the "object" does not support slicing but I found the answer here: http://forum.unity3d.com/threads/17089-Type-Object-does-not-support-slicing-(error)

But the solution bring me new issues, this time with the char class.

My code: //--------------

class Matrix extends System.Object
{

  var xMax : int;
  var zMax : int;
  var matrixLevel : String;


  function Matrix(xM : int, zM : int) {
     xMax = xM;
     zMax = zM;
     matrixLevel = new String[xM+1][zM+1];

  }
} //End class Matrix

// ------------------------ I want a matrix of Strings where I plan to store the GameObject.tag for each level of my game. Each level will have a different matrix size.

Problem now is here:

// ------------------------
  var AuxStr : String;
  AuxStr = scAux.data.matrixLevel[xMatriz+xAux][zMatriz+zAux];
// ------------------------

When I try to pull out the string value to use it in "GameObject.FindWithTag(AuxStr)" later, I can`t do it. I got this time the "char does not support slicing" error.

I realize that this problem only happen with Android/IOS settings, the array build work fine in PC.

How I can I fix this? Is driving my nuts!!

Sorry for my grammar, English is not my mother language. Thanks in advance!

more ▼

asked Mar 06 '12 at 02:27 PM

Ordosx gravatar image

Ordosx
5 5 9 11

For starters, I recommend explicitly stating the types of all your variables, especially the arrays. See if that helps you. It seems that it is treating the strings like char arrays- (which, they are, but that isn't what you want here). Make sure it knows that it's a jagged array of strings, not just a string that you are trying to cut up.

Mar 06 '12 at 02:31 PM syclamoth
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1963
x1363
x81
x12

asked: Mar 06 '12 at 02:27 PM

Seen: 397 times

Last Updated: Mar 06 '12 at 02:31 PM