-
Notifications
You must be signed in to change notification settings - Fork 840
Fix issue when switching back to custom sensor type in physical camera #417
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
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
817761b
Fix issue when switching back to custom sensor type in physical camera
pmavridis 555c387
make if comparison more explicit
pmavridis 4904304
make if comparison more safe
pmavridis 125c218
Per-camera history for the custom settings using a static dictionary
pmavridis 098f94d
Use ConditionalWeakTable instead of a Dictionary to avoid keeping ali…
pmavridis 753523d
Merge branch 'HDRP/staging' into HDRP/case_1244350
sebastienlagarde 5ece844
Merge branch 'HDRP/staging' into HDRP/case_1244350
sebastienlagarde File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Nice!
Does it need to be an object and not a vector2 though? I guess it is for checking if the value is there or not? If that's the case TryGetValue returns false if the object is not found.
Uh oh!
There was an error while loading. Please reload this page.
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.
Also -def not needed, but for future reference- to slightly decrease the cost of the hashing and memory consumption of this table, you could use the instance id of the object (Camera) as a Key which is unique per unity object. (Can query from the game object with GetInstanceID() )
This would also solve the issue with not being able to use the dictionary to not keep Cameras alive, though the Weak table is nice in that it auto deletes stuff when is not used anywhere else.
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.
Unfortunately ConditionalWeakTable work only with reference types, so I could not use Vector2 directly, it does not even compile. There is some overhead with the boxing operation, but this is paid only when the user switches from a preset to custom in the UI. Scripts that add/delete cameras will never hit that.
Using a traditional dictionary + instanceID is certainly an alternative, not sure if it is better or worse.