-
-
Notifications
You must be signed in to change notification settings - Fork 0
StrangeHub
Video Tutorial
Coming soon - video tutorial placeholder
The StrangeHub is the central manager component for Strange Toolkit. It handles atmosphere switching, toggle persistence, and object tracking.
Every world using Strange Toolkit needs exactly one StrangeHub. It's created automatically via the World Tab or can be added manually.
| Property | Type | Description |
|---|---|---|
| atmosphereNames | string[] | Display names for each atmosphere |
| atmosphereDefaults | bool[] | Which atmosphere loads on world start |
| atmosphereSkyboxes | Material[] | Skybox material for each atmosphere |
| atmosphereUseFog | bool[] | Whether fog is enabled per atmosphere |
| atmosphereFogColors | Color[] | Fog color per atmosphere |
| atmosphereFogDensities | float[] | Fog density per atmosphere |
| atmosphereRoots | GameObject[] | Root objects to toggle per atmosphere |
| Property | Type | Description |
|---|---|---|
| cleanupProps | GameObject[] | Objects to track for position reset |
Switches to the specified atmosphere.
// Switch to atmosphere at index 2
hub.ApplyAtmosphere(2);What it does:
- Sets the skybox material
- Enables/disables fog
- Sets fog color and density
- Toggles linked root objects (previous off, new on)
Cycles to the next atmosphere in the list.
// Cycle to next atmosphere
hub.NextAtmosphere();Wraps around to the first atmosphere after the last.
Saves a toggle state for the current player.
// Save that "bedroom_light" is ON
hub.SaveToggleState("bedroom_light", true);Retrieves a saved toggle state, or returns the default if not found.
// Load state, default to false if not saved
bool isOn = hub.LoadToggleState("bedroom_light", false);The hub maintains parallel arrays for persistence:
-
_savedIds[]- Toggle identifiers -
_savedStates[]- Corresponding boolean states
When a toggle saves state:
- Hub searches for existing ID
- If found, updates the state
- If not found, adds new entry (arrays expand in chunks of 32)
Note: Persistence is per-player, stored locally. It resets when the player leaves and rejoins.
- Hub initializes persistence arrays
- Finds the default atmosphere (first with
atmosphereDefaults[i] == true) - Applies the default atmosphere
- Toggles call
SaveToggleState()on interaction - Atmosphere switches call
NextAtmosphere()orApplyAtmosphere()
- Toggles call
LoadToggleState()to restore their state
The hub works with custom inspectors:
- StrangeHubEditor - Shows atmosphere management UI
- World Tab - Creates and configures the hub
- Keep at scene root level
- Don't parent to moving objects
- Ensure it's always active
- Set exactly one default atmosphere
- Use linked roots for complex lighting changes
- Keep skybox materials optimized
- Use unique, descriptive IDs
- Keep IDs consistent across versions
- Document your ID scheme
// In another UdonSharp behavior
public StrangeHub hub;
public void SwitchToNightMode()
{
// Assuming night is at index 1
hub.ApplyAtmosphere(1);
}
public void CycleAtmosphere()
{
hub.NextAtmosphere();
}- Check that arrays are properly sized (all same length)
- Verify skybox materials are assigned
- Check for null references in linked roots
- Verify toggles have unique IDs
- Check that toggles reference the hub
- Ensure
usePersistenceis enabled on toggles
- Check
atmosphereUseFogis true for that index - Verify fog is enabled in lighting settings
- Check fog density isn't zero