using UnityEngine;
using System.Collections;
public class Door : MonoBehaviour {
public GameObject Activator;
// Use this for initialization
void Start () {
animation.wrapMode = WrapMode.Once;
}
private int anim;
// Update is called once per frame
void Update () {
//if(Activator.GetComponent<Varics>().Status){
if(Input.GetButton("Fire1")){
if(!animation.isPlaying && anim==1){
animation.Play("open");
anim=0;
GameObject.Find("door/Plane.001").collider.isTrigger=true;
GameObject.Find("door/Plane.002").collider.isTrigger=true;
}
}else{
if(!animation.isPlaying && anim==0){
this.animation.Play("close");
anim=1;
//this.collider.isTrigger=true;
GameObject.Find("door/Plane.001").collider.isTrigger=true;
GameObject.Find("door/Plane.002").collider.isTrigger=true;
}
}
Debug.Log(Activator.GetComponent<Varics>().Status.ToString());
}
}
вот такой код(весит на двери) есть,но если я объекту главному меняю имя,он не работает,как изменить свойства чаилда независимо от имени объекта?
Как пикать объект лучом и возвращать его имя?