-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
Phantom Camera disappears when re-adding a scene to a tree #253
Comments
Am not sure if this is an addon issue? Based on your description, it suggests that you're using In any case, have you tried creating a reference to the |
I have not tried groups. I might give that a go next time it comes up! |
UPDATE: After several hours of testing, I found the exact step things break. It seems to be an issue with the @onready variable in conjunction with request_ready(); since the phantomcamera path changes when it's set to ThirdPerson (it becomes a child of a springarm3d), it is unable to find it using the original node path. Edited the original post to compensate. |
Had a look at the MRP, and the issue isn't related to the addon. The issue is also present if you were to add any other node as a sibling to the Have added a generic Also included in the And you get null references still once it re-enters the tree: What you're doing is that you're referencing a node using You would probably be interested in the addition of #288, as that would simplify finding a given |
The value should not be null up until the request_ready() causes the @onready variable to be set again. (Printing out the value while it's not in the tree won't return null until it re-enters.) Regardless, the linked features (and also the "group" solution) definitely handle the situation! Thanks for pointing those out! |
This would be an issue you would run into for any node type that you reference using the scene unique identifier, i.e. the That said, even by using the When you then tell the |
Issue description
In my game, there is a PhantomCamera3D attached to the player and saved as a variable. At one point, the player is removed from the tree, but not freed. At a later point, the player is re-added to the tree.
At this point, the variable that referenced the PhantomCamera3D becomes null, and it becomes difficult to re-assign the variable PhantomCamera3D.
At the very least, it would be good to have an easy way to reassign the variable, since using the node's path (like in the @onready declaration) doesn't work at this point.
Steps to reproduce
Add a node with a PhantomCamera3D child. The PhantomCamera3D should be set to "ThirdPerson" so that it becomes a child of a SpringArm3D at runtime.
In a script on the node, create an @onready variable called phantom_camera that equals the PhantomCamera3D.
EDIT: Make sure the node requests ready(), so that the @onready variable tries to be set when it re-enters the tree.
Remove the node from the tree.
Re-add the node from the tree.
The phantom_camera variable will be empty.
(Optional) Minimal reproduction project
https://github.com/Paul-Griffin-1517-1/PCamBreaker
The text was updated successfully, but these errors were encountered: