- Home /
Trigger Problem
I have a 2D Object with a 2D box collider set to Trigger. It is the Time upgrade. The circle is the player. This is what happens: The script is made to slow down time when the player triggers the collider. The player is not in contact with the collider but the time still slows down. There is no collider anywhere else which will slow down time. Please Help me
Can you show a video of this happening in scene view with the player and Time upgrade selected?
I suspect that the cone attached to the top of the player is triggering the Time upgrade, since colliders can fall through to their child sprites.
Thanks for replying! But I have solved the problem by moving the Collison code to my player script. Now it works like a charm? Anyway thanks for replying!
Answer by antounk · Jan 06, 2021 at 06:50 AM
so; i'm guessing your you slow the time using something like this:
void slowTime()
{
//do something to slow time
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.CompareTag("x"))
{
slowTime();
}
}
if so try using making a script called timeNormal() or something and put it in the ontriggerexit funcrion:
void timeNormal() {
//something
}
private void OnTriggerExit2D(Collider2D other)
{
if (other.CompareTag("x"))
{
timeNormal();
}
}
if that doesn't help please send your script and i'll see what i can do goodluck in your game
Your answer
Follow this Question
Related Questions
change collision to trigger 2 Answers
OnTriggerEnter() not working on faster speeds 0 Answers
Can't click gameobject when over another trigger? 1 Answer
If trigger hit, spawn it 1 Answer
Delay audio collisions 1 Answer