As you can see i print test and test 2 into the console and only test2 shows up. is this a bug or did i do someing wrong? The Awake function doesnt work either and actually disables the entire script. ( this isnt the entire script i omitted the irrelevant portions but it doesnt throw any errors)
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine;
public class Pieces : MonoBehaviour
{
public static int[][] MyPositions;
public int[] pos;
public static int piece_selected = 0;
string Type;
public int[][] LegalMoves;
char color;
// Start is called before the first frame update
void Start()
{
Debug.Log("test");
Array.Clear(MyPositions, -1, 64);
Array.Clear(LegalMoves, 0, 64);
color = (char)gameObject.ToString()[0];
Type = gameObject.ToString().Remove(0, 1).TrimEnd('1').TrimEnd('2');
transform.position = new Vector2(-5.1f + (1.459f * (float)pos[0]), -5.1f + (1.459f * (float)pos[1]));
MyPositions[pos[0]][pos[1]] = GetPiece(Type);
FindPieceLegality();
}
void Update()
{
Debug.Log("test2");
if (Squares.SquareClicked[0] == pos[0] & Squares.SquareClicked[1] == pos[1])
{
piece_selected = GetPiece(Type);
Debug.Log(piece_selected);
}
if (Squares.GoTo[0] != -1 & piece_selected == GetPiece(Type) & LegalMoves[Squares.GoTo[0]][Squares.GoTo[1]]==1)
{
transform.position = new Vector2(-5.1f + (1.459f * Squares.GoTo[0]), -5.1f + (1.459f * Squares.GoTo[1]));
MyPositions[pos[0]][pos[1]] = 0;
pos[0] = (int)Squares.GoTo[0];
pos[1] = (int)Squares.GoTo[1];
MyPositions[pos[0]][pos[1]] = GetPiece(Type);
Squares.GoTo[0] = -1;
piece_selected = -1;
FindPieceLegality();
}
}