farming game with replanting problem

so i’m making a farming game where you grow colorful squares, and i’m having a little problem. you can click on a plot of land, and when you do that, a square grows, such as this

alt text

once you click to collect them, though, you can’t replant them. i know why this is, for the plots of land have a variable that tells them if something is being grown on them or not, and that’s not being reset.

the only problem with doing this is that i can’t figure out how to set the variable to false! i assume that it has to go here -

alt text

i figure that i need some sort of way to identify which plot is being farmed, but that’s something i don’t know how to go about either, i’m very new to this. if anyone can help, that would be great!

EDIT: this is my full code for both scripts-

alt text

alt text

this should probably explain it a little better…

EDIT: i ended up making prefabs for all the plots and the plants, to try something out. i feel like that’ll make things easier.

Because you seem extremely new to programming, this resource will most likely help you:

http://www.unityscript.com/lessons1/basics.php

To set a boolean false, you need booleanVariable = false;

To determine if anything is grown on a cube, have a script on it that keeps track what is grown on it.

You might want to post a little more of your code (probably entire script) so that we can get a full understanding of what you are trying to do… What I would suggest however, is that instead of Destroy(gameObject); (which is destroying the cube altogether), try setting the cube to inactive…

gameObject.SetActive(false);

This method will actually be a lot less CPU intensive as well (you aren’t creating new instances of the object and destroying them.

Hope this helps!

-Drew