Skip to content Skip to sidebar Skip to footer

Increment A Y And X Axis Unity C#

How can i possibly increment a Y axis in c# For Example i have this data(prefab) P = Player B = Boss T = Travern This is shown like this : What currently i can do in my code: Ga

Solution 1:

o.transform.localPosition=new Vector3 (o.transform.localPosition.x,o.transform.localPosition.y+i,o.transform.localPosition.z);

Should increment only the y axis by i;

Solution 2:

Sorry for the late answer . Here's what i did.

string[,] table = new string[104, 6];

string newPreviousValue = "placeholder";
int xIndex = -1;
int yIndex = 0;

if (table.GetLength(0) < xIndex)
            {
                break;
            }

            if (previousValue.Equals(newPreviousValue) && yIndex < table.GetLength(1) - 1)
            {
                yIndex += 1;
                table[xIndex, yIndex] = previousValue;
            }
            else
            {
                xIndex += 1;
                yIndex = 0;
                table[xIndex, yIndex] = previousValue;
            }
            newPreviousValue = previousValue;

Post a Comment for "Increment A Y And X Axis Unity C#"