- Home /
After building move doesnt move
i have trigger in editor it works and my wall move up but after build not working..so i install in game debug console..and i build again then when i enter trigger (in game not editor ) i see this error message:
" NullReferenceException: Object reference not set to an instance of an object cikiskapitrigger.OnTriggerEnter ( UnityEngine.Collider other) ( at:0) "
Also here is my trigger script:
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;
}
}
}
Answer by Klarax · Feb 10, 2020 at 01:07 PM
hard to really know without getting hands on but it sounds like something is getting destroyed or something along those lines.
i cant tell if oyuncu cant be found or if this class can no longer be found
also -> I've never used gameObject.comparetag before i just use
gameobject.tag == "whatever its called"
i solved problem writing new script it works..
Your answer
Follow this Question
Related Questions
Move a wall up when player steps on trigger 2 Answers
Auto aim and shoot turret issues 5 Answers
Enemies disappear randomly 1 Answer
Get the colliders transform (?) 1 Answer
Check if another object exist in a position before respawning 1 Answer