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,24 @@
{
"name": "URPWizard",
"rootNamespace": "",
"references": [
"Unity.RenderPipelines.Universal.Runtime"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [
{
"name": "com.unity.render-pipelines.universal",
"expression": "",
"define": "USE_URP"
}
],
"noEngineReferences": false
}

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 18828b1d1020dde47bec693eef18a5b9
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 267961
packageName: 'Starter Assets: Character Controllers | URP'
packageVersion: 2.0.2
assetPath: Assets/Starter Assets/Editor/URPWizard/URPWizard.asmdef
uploadId: 721456

View File

@@ -0,0 +1,73 @@
using System.Linq;
using UnityEditor;
using UnityEditor.PackageManager;
using UnityEngine;
using UnityEngine.Rendering;
#if USE_URP
using UnityEngine.Rendering.Universal;
#endif
public class URPWizard : EditorWindow
{
[InitializeOnLoadMethod]
static void OnInitialize()
{
URPCheck();
}
static void URPCheck()
{
if (GraphicsSettings.currentRenderPipeline != null)
return;
var request = Client.List();
while (!request.IsCompleted) { }
if (request.Status != StatusCode.Success)
return;
if (request.Result.All(info => info.name != "com.unity.render-pipelines.universal"))
{
var addRequest = Client.Add("com.unity.render-pipelines.universal");
while (!addRequest.IsCompleted) { }
Client.Resolve();
}
else
{
FindAndAssignPipeline();
}
}
#if USE_URP
static void FindAndAssignPipeline()
{
var existingPipelines = AssetDatabase.FindAssets("t:UniversalRenderPipelineAsset");
if (existingPipelines.Length == 0)
{
Debug.LogError($"Universal Render Pipeline Asset was not found.\n" +
$"Please create one and assign under the Project Settings > Graphics > Scriptable Render Pipeline Settings.");
return;
}
var pipeline = AssetDatabase.LoadAssetAtPath<UniversalRenderPipelineAsset>(AssetDatabase.GUIDToAssetPath(existingPipelines[0]));
GraphicsSettings.defaultRenderPipeline = pipeline;
}
class PipelineAssetProcessor : AssetPostprocessor
{
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths, bool didDomainReload)
{
//if we have no pipeline set, we try to find one as one may have been imported
if (GraphicsSettings.currentRenderPipeline != null)
return;
FindAndAssignPipeline();
}
}
#else
static void FindAndAssignPipeline(){}
#endif
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 6c1ba780f87ca5a4ea89d3330464ecf5
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/Editor/URPWizard/URPWizard.cs
uploadId: 721456