microX
microX
CC#
Created by microX on 5/4/2023 in #help
✅ object types?
hey ive been following this video on how to make tictactoe, for a class assignment, (https://youtu.be/AzPgov_stdI?list=PLWeGoBm1YHVj7cYQSglzBU0gb7ecDNf4g) this guy uses images for his X's and O's. i decided to make gameObjects out of 3Dobjects (bc my teacher is not smart and would accuse me of cheating if i use pictures...)
c#
public void tictactoeButton(int WhichNum)
{
tictactoespaces[WhichNum].GameObject = playerIcons[playerIcons];



//...

if(playerTurn == 0)
{
playerTurn = 1;
}
else
{
playerTurn = 0;
}
}
c#
public void tictactoeButton(int WhichNum)
{
tictactoespaces[WhichNum].GameObject = playerIcons[playerIcons];



//...

if(playerTurn == 0)
{
playerTurn = 1;
}
else
{
playerTurn = 0;
}
}
i have this code here which is supposed to mark the spaces when you click them. but i get this error, when i save: Assets\scripts\NewBehaviourScript.cs(39,35): error CS1061: 'Button' does not contain a definition for 'GameObject' and no accessible extension method 'GameObject' accepting a first argument of type 'Button' could be found (are you missing a using directive or an assembly reference?) any help? this is his code btw:
c#
public void tictactoeButton(int WhichNum)
{
tictactoespaces[WhichNum].image.sprite = playerIcons[playerIcons];



//...

if(playerTurn == 0)
{
playerTurn = 1;
}
else
{
playerTurn = 0;
}
}
c#
public void tictactoeButton(int WhichNum)
{
tictactoespaces[WhichNum].image.sprite = playerIcons[playerIcons];



//...

if(playerTurn == 0)
{
playerTurn = 1;
}
else
{
playerTurn = 0;
}
}
23 replies