- Home /
Question by
shadowkiller0071 · Aug 14, 2014 at 09:48 AM ·
javascriptprefab
Prefab connection is not breaking?
I've made 2 different key type objects in my game, each of them with a different function #1 activates a basic bridge which is just a cube with 2d colliders in a variable #2 deactivates a cube to open doors. I made them both separately with different scripts but when I tried to set the texture of the bridgeKey (this was without making a prefab) is automatically changed the texture of the doorKey's prefab and thus it in all of my levels. This makes no sense because they aren't connected. Can someone explain? I will put script below but I don't think that they have any problems. enter code here
#pragma strict
var sphere : GameObject;
var keyItem : GameObject;
function OnTriggerExit2D(other : Collider2D) {
keyOpen();
}
function keyOpen() {
sphere.active = true;
keyItem.active = false;
}
//the code for the door next
#pragma strict
var sphere : GameObject;
function OnTriggerExit2D(other : Collider2D) {
keyOpen();
}
function keyOpen() {
sphere.active = false;
}
Comment