- Home /
Question by
unity_YYoxtjdH92iNIg · Feb 07, 2020 at 03:15 AM ·
gameobjecttriggerbuild and runtransform.translate
wall doesnt move after build
in editor it is working but after build not working..
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class cikiskapitrigger : MonoBehaviour
{
public float hiz = 1f;
public Transform doorthatmove;
public float timer;
public float sayac;
public AudioClip calinacakses;
public float ses;
AudioSource sesyeni;
public bool alreadyplayed = false;
void Start()
{
sesyeni = GetComponent<AudioSource>();
}
void OnTriggerEnter(Collider other)
{
if (!alreadyplayed&&other.gameObject.CompareTag("oyuncu"))
{
sesyeni.PlayOneShot(calinacakses, ses);
alreadyplayed = true;
StartCoroutine(Transform());
}
}
IEnumerator Transform()
{
while (doorthatmove.gameObject.transform.position.y < 12)
{
doorthatmove.gameObject.transform.Translate(0, hiz * Time.deltaTime, 0);
yield return null;
}
}
}
Comment