I am trying to figure out how to use Unity for Planning and Architectural purposes, specifically to toggle between Existing Conditions and Proposed Conditions. I’ve previously used Blitz3D for creating these simulations but am now thinking about using Unity, which in some ways seems much easier, and in other ways, seems much more difficult.
So, I’ve gone through a few attempts, and this is the closest I am coming:
code:
function Update () {
if (Input.GetButton("Alternative1")){
exists = GameObject.FindGameObjectsWithTag("Exist"); //returns all of the objects that are "tagged" with the attribute "Exist"
for (var exist: GameObject in exists) {
exist.renderer.enabled = false;
}
Alt1s = GameObject.FindGameObjectsWithTag("Alt1");//returns all of the objects that are "tagged" with the attribute "Alt1
for (var alt1 : GameObject in Alt1s) {
alt1.renderer.enabled = true;
}
}
if (Input.GetButton("Existing")){
exists = GameObject.FindGameObjectsWithTag("Exist"); //returns all of the objects that are "tagged" with the attribute "Exist"
for (var exist: GameObject in exists) {
exist.renderer.enabled = true;
}
Alt1s = GameObject.FindGameObjectsWithTag("Alt1");//returns all of the objects that are "tagged" with the attribute "Alt1
for (var alt1 : GameObject in Alt1s) {
alt1.renderer.enabled = false;
}
}
}
(this is my first post…not sure how to get the code into that neat little code box…I would think it would be part of the Markdown Basics, but I guess it’s not.)
Here’s what happens: The simulation starts with Existing showing (that’s good). When I press “1” (which is the “Alternative 1” button) then the meshes tagged with “existing” are toggled off (or rather, their rendering is disabled), and the meshes tagged with “alt1” are turned on (rendering enabled). (this is all good too!)
When I press “e” (which is the “Existing” button) then the meshes tagged with “alt1” turn off (which is good). Unfortunately, the “existing” meshes don’t come back.
However, if I press “1” again, the alternative 1 meshes come back, and when I press “e” for the second time, the alternative 1 meshes disappear and oddly the existing meshes come back!
Additionally, when I create a webplayer, it acts in a different way. You can see it here: my example
What happens in the webplayer is that when I hit the “1” key, the alternative 1 meshes toggle on and off, which is exactly what i want. When I eventually get to the Existing meshes, and I hit the “e” key, then I can toggle the Existing on and off…But, if the existing meshes are toggled on, I want to be able to hit the “1” key and turn off the existing and turn on alternative 1 meshes at the same time. I can’t seem to figure out how to do this.