Added basic character controller via importing Starter Assets from Unity.

This commit is contained in:
2025-11-08 11:59:44 +09:00
parent 3e92e5684a
commit e7e0733258
347 changed files with 46833 additions and 8 deletions

View File

@@ -0,0 +1,41 @@
/*
The PlayerInput component has an auto-switch control scheme action that allows automatic changing of connected devices.
IE: Switching from Keyboard to Gamepad in-game.
When built to a mobile phone; in most cases, there is no concept of switching connected devices as controls are typically driven through what is on the device's hardware (Screen, Tilt, etc)
In Input System 1.0.2, if the PlayerInput component has Auto Switch enabled, it will search the mobile device for connected devices; which is very costly and results in bad performance.
This is fixed in Input System 1.1.
For the time-being; this script will disable a PlayerInput's auto switch control schemes; when project is built to mobile.
*/
using System;
using UnityEngine;
#if ENABLE_INPUT_SYSTEM
using UnityEngine.InputSystem;
#endif
public class MobileDisableAutoSwitchControls : MonoBehaviour
{
#if ENABLE_INPUT_SYSTEM && (UNITY_IOS || UNITY_ANDROID)
[Header("Target")]
public PlayerInput playerInput;
void Start()
{
DisableAutoSwitchControls();
}
void DisableAutoSwitchControls()
{
playerInput.neverAutoSwitchControlSchemes = true;
}
private void Update()
{
Debug.Log(playerInput.currentControlScheme);
}
#endif
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 901182334643ba1438a25accc6bd0c79
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 267961
packageName: 'Starter Assets: Character Controllers | URP'
packageVersion: 2.0.2
assetPath: Assets/Starter Assets/Runtime/Mobile/Scripts/Utilities/MobileDisableAutoSwitchControls.cs
uploadId: 721456