Need help with modifying the code to my tic-tac-toe game in unity
I need help modifying my code for a tic-tac-toe game I’m building in unity. for some reason it won’t work when I click on my tic-tac-toe grid and won’t do anything (won’t bring up the O’s and computer player that i implemented won’t do anything either.
Not sure if the clicks aren’t registering, if so I’m not sure why. Any help will be deeply appreciated. This is the error that pops up, I only have one error in my code and it’s this:
Error: UnityException: Tag: TicTacToeMarker is not defined. TicTacToeAI.StartGame () (at Assets/Scripts/TicTacToeAI.cs:75)
I’ve attached a video and photo that should help with some clarity. Also attached is the text file with the code as it exceeded the word limit. The photo shows where the error takes me when I click on it. I’m also using Rider for reference.
3 Replies
the clicks arent probably registering, you need to implement the OnMouseDown method in your class
then use Physics.Raycast to know where you clicked
Thanks, will try this
My code finally works, apparently it was because I didn’t have the tag for TicTacToeMarker in my project settings. Here is the final result: