Question by
sniperguy124 · Jun 11, 2016 at 12:42 PM ·
triggererror messageunknown
Unknown Error! PLZ HALP!!11
I am trying to make a "Button" that will open a door in a 2d enviroment. I get an error on the triggerScript saying "the associated script can not be loaded. please fix any compile errors and assign a valid script" I have made a sprite called TriggerObject that has the triggerTrigger script bellow.
using UnityEngine;
using System.Collections;
public class triggerTrigger : MonoBehaviour
{
public static bool isTrigger = false;
public void OnTriggerEnter2D(Collider2D other)
{
if (isTrigger == false)
{
Debug.Log("Collided!");
isTrigger = true;
}
}
public void OnTriggerExit2D(Collider2D other)
{
if (isTrigger == true)
{
Debug.Log("Exit!");
isTrigger = false;
}
}
}
Ive also got a door called Door1 with the script down below
using UnityEngine;
using System.Collections;
public class Trigger : MonoBehaviour
{
Vector3 tempPos;
public void Start()
{
GameObject triggerObject = GameObject.Find("TriggerObject");
triggerTrigger TriggerTrigger = triggerObject.GetComponent<triggerTrigger>();
Debug.Log("TRIGGER INITIALIZED");
}
public void Update()
{
if (triggerTrigger.isTrigger == true)
{
Debug.Log("MOVING");
tempPos = transform.position;
tempPos.y -= 0.05f;
transform.position = tempPos;
}
}
}
If i could get some advice, that would be perfect!
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612082655im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Inexplicable error 0 Answers
what does this error mean? javascript 0 Answers
(C#) Stack overflow caused by unknown operation 1 Answer
Trigger animation transition not working 0 Answers
how do i trigger state machine ? 2 Answers