- Home /
Boolean from other class
Hello, I have two classes. The first have a trigger and the second have a parameter. Please, I need to conect the two classes to when I enter on the trigger, I can change the parameter.
void OnTriggerEnter(Collider other)
{
if (other.transform.tag == "mytag")
{
myboolean = true;
if(myboolean == true)
{
}
}
}
My other class:
transform.Translate(Vector3.forward * Time.deltaTime * speed);
I need to change the translate direccion on trigger enter.
Thank You!!
Answer by YoungDeveloper · Dec 31, 2013 at 12:44 AM
I reread you question but still didn't 100% understand what you want, sorry. And none of these are classes, these are methods.
Yes, there are two methods in two diferents classes. I need to join them and when my boolean was true, the other class can read it and I can change the speed for example.
Answer by PippyLongbeard · Dec 31, 2013 at 01:48 AM
Just make the speed variable negative if myboolean = true. Otherwise, it's positive.
Your answer
Follow this Question
Related Questions
Coding question 1 Answer
Is there other Unity 3D Resources? 0 Answers
True Newbie; where to proceed 0 Answers
Fog and shader 0 Answers
I'm a noob. How to build a game? 0 Answers