2.8 KiB
2.8 KiB
Cocos Scene Setup
Platform Node Spawner
Use this configuration to control which prefabs appear based on the current platform.
Setting | Value | Description |
---|---|---|
Desktop Toggle | ✅ Enabled | Show prefab on desktop |
Mobile Toggle | ❌ Disabled | Hide prefab on mobile |
Target Prefab | prefab name |
Name of the prefab to be spawned |
Platform ui controller
-
Attach this script to any node that should only appear on a specific platform.
-
At runtime, the node will automatically be removed if it doesn’t match the active platform.
Setting | Value | Description |
---|---|---|
Desktop Toggle | ✅ Enabled | Show node on desktop |
Mobile Toggle | ❌ Disabled | Hide node on mobile |
Node Spawner
Spawns a prefab at the same position as the original node and then removes the node.
Usage
- On scene start, the prefab replaces the node.
- Attach the script to a placeholder node.
- Set the
prefab
property in the Inspector.
UI Mobile Landscape / Portrait Position
Positions a node at a specific location when the device is in landscape / portrait mode on mobile.
Usage
- Attach the script to your node.
- Set
default Position
in the Inspector. - The position updates automatically in mobile landscape / portrait mode.
Orientation UI Controller
Manage UI visibility based on device orientation (landscape or portrait).
Property | Type | Default | Description |
---|---|---|---|
isLandscape | Boolean | true | Indicates if the UI should be visible in landscape mode. Automatically syncs with isPortrait. |
isPortrait | Boolean | false | Indicates if the UI should be visible in portrait mode. Automatically syncs with isLandscape. |
useActiveObject | Boolean | false | Visibility method: - false : Uses opacity (0-255)- true : Uses node active state |
Notes:
- Automatically keeps landscape and portrait states in sync.
- Supports both opacity and active state for controlling visibility.