Have an object, called “PressurePlate” broadcast its OnTriggerEnter status to another script.
This “other” script is the main script for the scene and allows the entire scene to function.
The Main Script is attached to a random game object, and the pressure plate has no script, and I need to keep it that way.
I will use a solution to this problem later on in the development of this script as well.
void OnTriggerEnter2D(Collider2D collider){
if (collider.name == "Wall") {
//Do something with Wall or your character
} else {
if (collider.name == "Floor") {
//Do something with floor or your character
}
I might have just found a way to explain it better. If I was confusing, please excuse me, I have Autism and Dyspraxia, and sometimes make mistakes (like a human)…
I have an empty gameobject. On this GameObject, there is a script.
I have a target.
If OnTriggerEnter = true on the target, I need to send that state of being true to the GameObject Script.
If you want to get an OnTriggerEnter call from the pressure plate, it has to have a script on it. OnTriggerEnter is sent only to scripts on the GameObject they’re attached to.
You can add a script to the pressure plate at runtime, if you want to avoid having it there at edit time?
Thank You for your help, I still don’t quite understand the runtime/edit stuff, however, with some shifting of my information into a script linked to the Pressure Plate, everything seems to be working!