xThingOne, Two, and yThingOne all are prefabs. I need those to go in the box’s position flat as they already were put into the prefab. Also, I need to know how i would locate some variables from a object in a script that are public. I Have declared Turn in another script. Thats why, because this script goes in many. THANKS A BUNCH!
For one thing, you are checking to see if the mouse is down on the mouse-over handler. Take out that ‘if mouse button’ thing. But then, just mousing over a square would instantiate things. So really, this code should be in OnMouseDown instead. I don’t know what you want to do in ‘over’
Another, you don’t need renderer.transform… just transform… because the renderer and the transform both belong to ‘this’ object.
I assume that ‘this’ object is one of 9 squares. It would instantiate at the position of what it is that was clicked, but it’s also taking the rotation of ‘this’ object. If you want the prefab’s default rotation, just use Quaternion.identity instead of transform.rotation.
You instantiate two things in ‘x’ and one in ‘y’. I assume you know what you’re doing, that this is some sort of test code, right?
I would consider splitting the game control (‘turn’ handling) out of this and putting it in a ‘game manager’ script that handles the rules. Unless Turn is static, each square would have it’s own copy of Turn, not good.
Also, not required, but convention has variables starting with a lower case letter. turn instead of Turn. Classes and Functions start with Capital letter.