Solved - A couple of glitches

I’ve noticed 2 (potential) issues with the transparency.

The first is that enemies trigger it. This means that if the player is under the canopy and the enemy triggers the exit, the player is obscured.

The second one is that attacking while transparency is on turns the transparency off.

To rectify this, I’ve created some more collision layers (enemy and weapon) and set the appropriate collisions in the project settings - Physics 2D - Layer Collision Matrix

1 Like

Hi Clive,

I was wondering if you possibly might share your TransparentDetection code as one of those things should not be happening using our code.

Firstly when the body enters the trigger collider it checks if it is the player by looking for the PlayerController. This means that enemies cannot trigger the fade coroutine unless there is an error in the code.

Also attacking is not in any way linked to the transparency code and so should not be affected by it, I’ve tested this on our code as well and i cannot get the transparency to trigger on attacking underneath a tree or the canopy.

I am glad you found a solution to your issue but there is an underlying cause that is not in the course code.

If you can post the associated code we can try and debug this issue with you :slight_smile:

Thanks, Marc.

You’re spot on. I make notes while watching the videos, and then try to use my notes to implement the lecture.

In this case, I didn’t note to start the OnTrigger…s with if (player) {}. Which is a far simpler fix than playing with layers.

In my defense, I am working hard to constructively critique Stephen’s work - and it’s really hard to find fault.

:slight_smile:

Great course. Really enjoying it.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms