Skip to content

Commit 4bb8521

Browse files
Ryan KimRyan Kim
authored andcommitted
readme updated with framecount and additivescenemanager
1 parent 80d1848 commit 4bb8521

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

README.md

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,44 @@ The existing list of serialized equivalents of primitive Unity classes are:
5656

5757
To use these serialized equivalents, you must import the namespace `using SerializableTypes`.
5858

59+
## Frame Count
60+
61+
The `FrameCount.cs` component helps you gain access to the following details about your game:
62+
63+
- `frame_count`: What's the current frame since the start of the game?
64+
- `fps`: What's the raw FPS of the game?
65+
- `smoothed_fps`: What's the smoothed FPS of the game?
66+
67+
The smoothed FPS is a weighted FPS value set between the raw FPS of that frame and the previous FPS value. This prevents shocks in FPS such as frame spikes from severely affecting the FPS value.
68+
69+
### Usage
70+
71+
You can access these values publicly as long as `FrameCount.cs` is present in your scene. Note that this component is a **singleton** and only one is needed in your current scene; you can reference it anywhere in your scene via `FrameCount.Instance`.
72+
73+
If you want to print the FPS on a `TextMeshProUGUI` textbox (i.e. debugging), this component can also handle that. The component comes with a `textboxes` list that lets you print out your desired variable in the textbox you reference it to.
74+
75+
5976
## Additive Scene Manager
6077

61-
Included in this package is an `AdditiveSceneManager.cs` component. This component is a special helper to enable ADDITIVE scene management. I.E. allows you to load and unload scenes on top of another existing, single scene. Helpful for situations where you may want singleton logic at a scene level, by containing major components in the base scene and only switching out certain content dynamically.
78+
Included in this package is an `AdditiveSceneManager.cs` component. This component is a special helper to enable ADDITIVE scene management. I.E. allows you to load and unload scenes on top of another existing, single scene. Helpful for situations where you may want singleton logic at a scene level, by containing major components in the base scene and only switching out certain content dynamically. Note that this component is a **singleton** and only one is needed in your base scene; you can reference it anywhere in either your base or additive scenes via `AdditiveSceneManager.Instance`.
6279

63-
### Usage
80+
### Installation
6481

6582
Installation is really simple: just add `AdditiveSceneManager.cs` to any GameObject in your base scene, and populate the `Scenes` list with all the additive scenes.
6683

67-
During runtime, if you are in the editor, you can debug how additive scenes load in via the Inspector; you can load and unload your additive scenes via some UI buttons we've added. You can also call the following functions to control loading and unloading:
84+
### Usage
85+
86+
You can think of the implementation as having a "Base" or "Core" scene where you place the `AdditiveSceneManager.cs` in, and then you have "Additive" scenes that you add on top of or remove from that base scene. The `AdditiveSceneManager.cs` component has two major ways of interaction:
87+
88+
1. `Scenes`: You must add any scenes you want to additively load here. All these scenes must also be check-marked in your "Build Settings".
89+
2. `References`: If any of your additive scenes require references to objects in the base scene, you can add references to them here. Then you can query this list to get `GameObject` references.
90+
91+
During runtime, if you are in the editor, you can debug how additive scenes load in via the Inspector; you can load and unload your additive scenes via some UI buttons we've added. Alternatively, if you are playing the game directly, you can instead call the following functions to control loading and unloading:
6892

69-
- `LoadScene(string scene_name, LoadSceneMode mode = LoadSceneMode.Additive)`: Loads a scene based on a string query. You CAN technically use this to load single scenes via the 2nd parameter, but this is not the intended function of this manager. **Only loads in scenes added to its `Scenes` list; doesn't control any scenes NOT added to that list.
70-
- `UnloadScene(string scene_name)`: Unloads a scene based on a string query. Only unloads a scene if 1) it's been added to the `Scenes` list of this manager, and 2) if it's loaded already. Doesn't do anything if the queried scene is unloaded already.
71-
- `QuerySceneLoaded(string scene_name)`: You can check if a scene has been additively loaded from this manager using this function. Returns a boolean indicating so.
93+
|Function|Parameters|Returns|Description|
94+
|:-|:-|:-|:-|
95+
|`LoadScene`|`string scene_name`, `LoadSceneMode mode = LoadSceneMode.Additive`|_null_|Loads a scene based on a string query. You CAN technically use this to load single scenes via the 2nd parameter, but this is not the intended function of this manager. **Only loads in scenes added to its `Scenes` list; doesn't control any scenes NOT added to that list.|
96+
|`UnloadScene`|`string scene_name`|_null_|Unloads a scene based on a string query. Only unloads a scene if 1) it's been added to the `Scenes` list of this manager, and 2) if it's loaded already. Doesn't do anything if the queried scene is unloaded already.|
97+
|`ToggleScene`|`string scene_name`|_null_|Rather than `LoadScene` or `UnloadScene`, you toggle the queried scene on or off.|
98+
|`QuerySceneLoaded`|`string scene_name`|`bool`|You can check if a scene has been additively loaded from this manager using this function.|
99+
|`TryGetRe`|`string query`, `out GameObject g`|`bool`|Try and get a reference saved by the `AdditiveSceneManager.cs` component. If no reference is found, returns `false`. if it finds the reference, it returns `true` and lets you access the GameObject via its `out` parameter.|

0 commit comments

Comments
 (0)