Okay so I have two cubes and I want it so when I click the first cube it is selected and when i click the second cube it deselects the first cube and selects the second cube. How would I go about doing this? Here is the first script I tried: #pragma strict
Using the first script, i think you will need to store the first cube you select as a Boolean variable after it is selected and make it true. Then say when you click the 2nd cube something like -
// Do this dynamically. So once the object is clicked, it // makes the var. You may need to disable Pragma Strict for // this
var cube1 = false;
var cube2 = false;
// Function with selecting the 2nd cube
if (cube1) {
// This part isn't actual code
cube1 = selected
else {
cube1 = false;
}
if (cube2) {
// This part isn't actual code again
cube2 = selected
}
else {
cube2 = false;