Hey guys - as the name suggests - trying to work through the giant hurtle of learning basic programming to get my game in the works. What I’m trying to do is make an RTS, and I’m simply writing code for the player to select a building (transform via the camera [player’s perspective]), it to look like it was selected, and then do various things from that.
So I’ll figure out the rest, however, I’m stuck at making the object selected. Basically, what I’m figuring, logic wise, is I want to write an if statement - if the transform (building) is selected, then draw the graphic of a green circle below the building (so you know it’s been selected). How would one do that? There’s no such thing as a transform.selected, eh?
In pseudocode I want this:
if (transform.Selected) {
greenCircle.enable(etc, etc, etc)
However, I’m guessing it’d be easier to just instantiate a green circle that I can just destroy later:
if (transform.Selected) {
Instantiate(greenCircle, GameObject.Find(“selectedGraphicspawnPoint”).transform.position, Quaternion.identity);
This is probably way messier than you gurus would probably do it, however the “transform.Selected” is obviously make believe. How would I go about this? How would I even allow a transform to be selected by the mouse?