doc-slot-core-manual/docs/07-faqs/03-setup-cocos-scene.md
2025-05-22 15:21:07 +07:00

65 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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
1. Attach this script to any node that should only appear on a specific platform.
2. At runtime, the node will automatically be removed if it doesnt 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.
1. Attach the script to a placeholder node.
2. 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
1. Attach the script to your node.
2. Set `default Position` in the Inspector.
3. The position updates automatically in mobile landscape / portrait mode.
![Position](./img/default-setting.png)
## Orientation UI Controller
Manage UI visibility based on device orientation (landscape or portrait).
![Position](./img/orientation-ui-controller.png)
| 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:<br />- `false`: Uses opacity (0-255)<br />- `true`: Uses node active state |
**Notes:**
- Automatically keeps landscape and portrait states in sync.
- Supports both opacity and active state for controlling visibility.