-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gameplay entered/exited signals and notification issues #56494
Comments
cc @lawnjelly |
After a bit of debugging, you may be a little embarrassed, but the problem is you are moving your test box in the wrong direction. 😀 If you look at your situation, you have an exterior room (0), a room that the camera is in on the left (1) and a room that the box starts in (2). In order to enter gameplay, the box from room (2) has to enter room (1) where the camera is, as there are no portals so it operates only on the rooms that objects are within. For this to happen the box has to move left in the diagram and x must be decreased, however the script is setup so that the x coordinate increases with each frame. Thus the box moves around of room 2 into room 0, then off to infinity, but never enters room 1. The reason it appears to work when you delete the exterior room is that once the box moves to the right into "no man's land", I can't remember exactly what happens but it may pick some default room like zero, which may coincidentally be the one in which the camera is. If you change the script to move the box correctly to the left, it works. 👍 On the plus side though this project did show up that #37626 is spamming warnings in some situations. I did mention at the time I wasn't sure that warning PR was a good idea. |
Closing as this seems to be a problem in the MRP rather than an engine bug. |
@lawnjelly I was convinced to have reproduced the issue in my main project. Now I managed to find the root cause of the issue in my main project though. |
Ah yes this may be true. Having a look, it looks like However, this in turn creates the appropriate Screen Entered and Screen Exited signal in the VisibilityNotifier, so you should be able to use this instead if you want to use signals. Here is the code which triggers them, in the same way as VisibilityNotifier usually works when objects enter and exit the screen:
There is no signal in the case where a VisibilityNotifier enters gameplay but is not in the view frustum (this tallys in because VisibilityNotifiers aren't intended to do anything except when they are in view). The logic is thus: I'll try and add this to the docs as it isn't clear in this particular case. It would in theory be possible to send both the notification AND signal in this case, but I think if you wanted the gameplay signal you could maybe put this on a script for the MeshInstance rather than the VisibilityNotifier. Let me know if this is a problem though because it can be changed if there isn't an easy way around this - some situations like this aren't immediately obvious during development and if we can make things easier in use with simple changes, that is worth doing. |
@lawnjelly Thanks for the clarification. In my project, I also want to know if a visibility notifier is in the gameplay even though it is not on screen. This is because my spawner logic uses visibility notifiers, but also I want to spawn some entities if the player is close enough but only if the visibility notifier is in the gameplay area. |
Yup I think on reflection this is probably a good compromise in your situation, because modifying the engine to send signals and notifications for this special case won't be very efficient, and we are after all doing all this for greater performance. So I guess we can say it is possible already, but just not documented yet. 👍 |
@lawnjelly I think I found a real bug this time. I have noticed that the gameplay_entered/gameplay_exited signals are not called when:
The first time you load the scene you get the callback, but not at step 4. It seems clear to me that some state is being retained if you unload a scene with a portal system and a camera active. 2.a) Deactivate/delete the active camera and do not activate any other camera. Not too pretty, but it works in my case as the loading screen starts with a black screen so, the two black screen frames are not noticeable. Here is the MRP which I derived from the previous one: roaming_gamplay_callback_issue.zip If you look at the root node you should see the workaround. Remove that and you only get the signal/notifications for "gameplay entered" the first time only. |
Yes it's possible I'm not sending gameplay exit signals when the room system is unloaded, more interesting is not sending the entered signal. There is probably something that just needs a reset, am investigating. 👍 |
Fixed by #57033. |
@lawnjelly I believe I found another related issue. The "gameplay_exited" signal is not triggered for the "exterior" RoomGroup (although the gamplay_entered is triggered when you "re-enter" the exterior room. I think this is important because it is what the tutorial says it should be used to toggle directional lights or other exterior exclusive stuff. |
@lawnjelly Actually it's a general problem for very room/roomgroup, not just the "exterior" one |
Ah I've figured it out, there is a bug, there's an optimization to prevent processing unless it changes rooms, but that isn't keeping the active room ids up to date. Should be quite easy to solve. 👍 |
Godot version
3.4.2 stable
System information
OS: Arch Linux, CPU: Ryzen 5, GUP: RX 480
Issue description
There are two maybe related issues with gameplay entered/exited signals and notifications.
Steps to reproduce
I have attached a minimal reproduction project with a roaming mesh instance that moves between two rooms. The print statements for notifications are never executed. The print statements for signals are not executed, but if the ExteriorRoom room group is deleted they will be triggered.
Note that I have not used any portals, but I assume this should work regardless. I have portals in my project, and I get the very same issue.
Minimal reproduction project
roaming_gamplay_callback_issue.zip
The text was updated successfully, but these errors were encountered: