I have a scripting file “PieceLogic.cs” added as a component of a GameObject, Piece. In the scripting file I have a class “PieceLogic”.
Now in another piece of script attached to a different GameObject, I have a reference of Piece. How do I get the instance of PieceLogic associated with Piece?
I tried these, which do not work:
PieceLogic pl = Piece.GetComponent<PieceLogic>("PieceLogic.cs");
and
PieceLogic pl = (PieceLogic)Piece.GetComponent("PieceLogic.cs");
That should be PieceLogic pl = GameObject.Find("Piece").GetComponent<PieceLogic>() Don't know why I'm having problems editing that.
– mhtraylor