[Unity] Added ability to look for Classes inside the linked list of Transforms #49
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 commit enhances the functionality of the
SceneManager
for games using the Unity engine by giving the ability to look for addresses of classes with no static reference.Traditionally, a static entry point is deemed necessary in order to easily access a certain instance of a class / struct in Unity games. However, the use of
Singleton
s and static references is becoming rare in modern games, as Unity devs reccommend attaching classes (especiallyMonoBehaviour
s) to a game object referenced by the currently running Unity scene.To put it simply, each Unity scene has a linked
List
of game objects calledTransform
s, with each one having, recursively, a childTransform
, and an array ofComponent
classes, which contain the data usually needed for the autosplitting logic.As the lack of a static reference makes it impossible to have an easy way to access those classes, the code added in this commit will provide a solution.
However, whenever possible, using a static reference shoould still be preferred, as searching through unity
GameObject
s is a fairly memory expensive operation (roughly 5-6 times slower).Hierarchy and inheritance can be looked for at runtime using Micrologist's UnityInstanceDumper.
The example provided here recovers the in-game timer from the game Wretched Depths (freely available on Steam):