This commit is contained in:
zhangzheng
2026-02-27 18:35:40 +08:00
parent adef8b4cce
commit 1bb1fee5cc
265 changed files with 104076 additions and 92 deletions

View File

@@ -0,0 +1,40 @@
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif
class PostProcess : IPostprocessBuildWithReport
{
public int callbackOrder { get { return 0; } }
public void OnPostprocessBuild(BuildReport report)
{
#if UNITY_IOS
if (report.summary.platform == BuildTarget.iOS)
{
string projectPath = report.summary.outputPath + "/Unity-iPhone.xcodeproj/project.pbxproj";
PBXProject pbxProject = new PBXProject();
pbxProject.ReadFromFile(projectPath);
//Disabling Bitcode on all targets
//Main
string target = pbxProject.GetUnityMainTargetGuid();
pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
//Unity Tests
target = pbxProject.TargetGuidByName(PBXProject.GetUnityTestTargetName());
pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
//Unity Framework
target = pbxProject.GetUnityFrameworkTargetGuid();
pbxProject.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
pbxProject.WriteToFile(projectPath);
}
#endif
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9a6fe6dcd54394a62ba7efc4d7352432
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,94 @@
using System;
using System.IO;
using System.Linq;
using Unity.RenderStreaming.Editor;
using UnityEditor;
using UnityEngine;
namespace Unity.RenderStreaming.Samples
{
[InitializeOnLoad]
class SampleSetup
{
private const string kSavePath = "Library/RenderStreamingSampleSettings.json";
private static string cacheGuid = "";
class DeleteSampleSettings : UnityEditor.AssetModificationProcessor
{
// When SampleSetup script is deleted, also delete RenderStreamingSampleSettings.json.
private static AssetDeleteResult OnWillDeleteAsset(string assetPath, RemoveAssetOptions options)
{
var existPath = AssetDatabase.GUIDToAssetPath(cacheGuid);
if (existPath.StartsWith(assetPath))
{
File.Delete(kSavePath);
}
return AssetDeleteResult.DidNotDelete;
}
}
static SampleSetup()
{
cacheGuid = AssetDatabase.FindAssets($"t:Script {nameof(SampleSetup)}")[0];
Load();
if (s_Settings.dialogAlreadyShowOnStartup || !RenderStreaming.AutomaticStreaming)
{
return;
}
const string dialogText =
"It is recommended to turn off AutomaticStreaming in the scenes included in the sample. Do you want to change the config assets for Sample?";
if (EditorUtility.DisplayDialog("Warning", dialogText, "Change Settings", "Ignore"))
{
var guids = AssetDatabase.FindAssets("t:RenderStreamingSettings");
var path = guids.Select(AssetDatabase.GUIDToAssetPath).First(x => x.EndsWith("RenderStreamingSample.asset"));
var asset = AssetDatabase.LoadAssetAtPath<RenderStreamingSettings>(path);
if (asset != null)
{
RenderStreamingEditor.SetRenderStreamingSettings(asset);
}
else
{
Debug.LogError("RenderStreamingSample.asset not found.");
}
}
s_Settings.dialogAlreadyShowOnStartup = true;
Save();
}
[Serializable]
private struct SerializedState
{
public bool dialogAlreadyShowOnStartup;
}
private static SerializedState s_Settings;
private static void Load()
{
s_Settings = new SerializedState();
if (!File.Exists(kSavePath))
return;
try
{
var json = File.ReadAllText(kSavePath);
s_Settings = JsonUtility.FromJson<SerializedState>(json);
}
catch
{
s_Settings = new SerializedState();
}
}
private static void Save()
{
var json = JsonUtility.ToJson(s_Settings, prettyPrint: true);
File.WriteAllText(kSavePath, json);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4f56783b5ff347029a1b5e685020003d
timeCreated: 1675922966

View File

@@ -0,0 +1,19 @@
{
"name": "Unity.RenderStreaming.Sample.Editor",
"rootNamespace": "",
"references": [
"GUID:40a5acf76f04c4c8ebb69605e4b0d5c7",
"GUID:7e479a0c97f111c48b6a279fad867f28"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9a72d92d453fffa418a5baa1727f851e
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: