-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Added engine detail to Camera.yaml #1053
base: main
Are you sure you want to change the base?
Conversation
A detail about camera behavior such as cameras getting parented to `nil` when `Workspace.CurrentCamera` is set to another camera.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @C-Corpze, thanks so much for helping improve the Roblox creator documentation! Our technical writing team will review your pull request soon. In the meantime, please ensure you've read through the README.md, contribution guidelines, and style recommendations.
Hi @C-Corpze , |
I'm uncertain if cameras are GC'd when parented to nil, not entirely sure how to test this again. What I did was create a bunch of cameras and whenever something changed, I would print their parent and attempt to reparent them back into workspace. I found out about this weird behavior when I was coding my own camera system from scratch, where I intend to have multiple camera objects that each can have their own independent post-processing effects and whatnot. I honestly wish this was customizable as I find it quite inconvenient at best that this keeps happening, I cannot rely on cameras always existing and instead have to implement some additional code checks to make sure I'm not trying to set the CFrame of something that is nil. |
Hi again @C-Corpze , |
To clarify, I simply create camera objects on the client using a local script and then parent them to workspace. I assume the same thing happens on the server as well when it's done in a server script. |
|
||
Warning: | ||
It should also be noted that when changing `Workspace.CurrentCamera` to a new `Camera` | ||
and there is more than a single `Camera` present in the top-hierarchy of `Workspace` | ||
then all other unused `Camera` objects shall be parented to `nil` but not `Destroy()`d. | ||
|
||
If you require a `Camera` to stay around, it is recommended to parent it inside a `Model` or object other than directly under `Workspace`. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warning: | |
It should also be noted that when changing `Workspace.CurrentCamera` to a new `Camera` | |
and there is more than a single `Camera` present in the top-hierarchy of `Workspace` | |
then all other unused `Camera` objects shall be parented to `nil` but not `Destroy()`d. | |
If you require a `Camera` to stay around, it is recommended to parent it inside a `Model` or object other than directly under `Workspace`. | |
#### Storing Multiple Cameras | |
Note that when changing `Class.Workspace.CurrentCamera` to a new `Class.Camera`, | |
all other `Class.Camera|Cameras` directly descending from `Class.Workspace` will be | |
destroyed. If you need to store multiple cameras and swap between them on demand, | |
it's recommended that you store them in a `Class.Folder` or `Class.Model` under | |
`Class.Workspace`, inside which they will remain even when | |
`Class.Workspace.CurrentCamera|CurrentCamera` is changed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this sound? I rephrased to say effectively the same thing, and advised using a Folder as another option to a Model to contain the cameras.
A detail about camera behavior such as cameras getting parented to
nil
whenWorkspace.CurrentCamera
is set to another camera.Current Roblox documentation lacks information about what happens when multiple camera objects are present in Workspace and the CurrentCamera property is changed to a different camera.
Cameras randomly being parented to
nil
might seem confusing and like some kind of bug if you can't even find anything about it in the documentation.