Skip to content

Added engine detail to Camera.yaml #1053

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

Merged
merged 6 commits into from
Apr 16, 2025
Merged

Added engine detail to Camera.yaml #1053

merged 6 commits into from
Apr 16, 2025

Conversation

C-Corpze
Copy link
Contributor

A detail about camera behavior such as cameras getting parented to nil when Workspace.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.

A detail about camera behavior such as cameras getting parented to `nil` when `Workspace.CurrentCamera` is set to another camera.
@C-Corpze C-Corpze requested a review from a team as a code owner March 18, 2025 13:55
@github-actions github-actions bot added the engine reference Changes the Engine API Reference documentation label Mar 18, 2025
Copy link

@github-actions github-actions bot left a 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.

@IgnisRBX
Copy link
Contributor

IgnisRBX commented Mar 18, 2025

Hi @C-Corpze ,
Good point to add, thanks! I assume that "discarded" Cameras will follow typical garbage-collection behavior and actually get destroyed unless you're holding on to them through a script or similar? In other words, once Workspace.CurrentCamera is changed and the other Cameras are parented to nil, I assume that they are eventually garbage-collected and destroyed unless there's some intentional script or link that's keeping them around?

@C-Corpze
Copy link
Contributor Author

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.

@IgnisRBX
Copy link
Contributor

Hi again @C-Corpze ,
Curious, how and when are you creating the additional cameras? I did a bit of testing and additional cameras don't seem to replicate at all once play begins, even if they're parented somewhere outside of Workspace. Are you creating them in a script after play begins?

@C-Corpze
Copy link
Contributor Author

C-Corpze commented Apr 3, 2025

Hi again @C-Corpze , Curious, how and when are you creating the additional cameras? I did a bit of testing and additional cameras don't seem to replicate at all once play begins, even if they're parented somewhere outside of Workspace. Are you creating them in a script after play begins?

To clarify, I simply create camera objects on the client using a local script and then parent them to workspace.
From the moment CurrentCamera is changed, the previous camera will be parented to nil.
This behavior is consistent and keeps happening.

I assume the same thing happens on the server as well when it's done in a server script.
Although, typically you don't create cameras on the server so this is of course not tested yet.

IgnisRBX
IgnisRBX previously approved these changes Apr 16, 2025
@IgnisRBX IgnisRBX merged commit d7314cf into Roblox:main Apr 16, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine reference Changes the Engine API Reference documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants