Add support for log contexts, and add logging of the loading object's GUID when finding an object by GUID failed. #2368
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.
This PR adds support for logging contexts, which are a simple way to pass information about the caller of a function when it passes through a large call stack and when parameters would be unnecessary. This adds a lot of value to the log in several situations.
For example, if a script on a prefab is referencing an actor that is in a scene, and the developer uses the prefab in another scene, the script's reference to the actor will be broken, and a log will be shown. In the current version of the log, it will simply say what object failed to be loaded. This means you can't search for it using the content finder (Ctrl+O) because the object doesn't exist. This PR adds an extra piece of information to the log: the GUID of the script which tried to load the object, allowing you to find the script which is missing a reference much more easily.
This system can further be expanded with more context information (the name of the field that failed to load, other kinds of contexts, etc).
If this PR gets merged, I will make a PR which adds more places with log contexts and expands on the system more.
This PR also adds functionality for the GUID of a script to be searched using Ctrl+O, although currently it will just highlight the script's parent actor the same way simply searching for an actor's GUID does. This feature can also be expanded upon.