Initial project commit

This commit is contained in:
2026-01-08 16:50:20 +00:00
commit f0c5a8b267
29596 changed files with 4861782 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b3fb8b56aca55544ca9b8d53bc19e031
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
namespace UnityEditor.Rendering.Universal
{
[CustomEditor(typeof(UnityEngine.Rendering.Universal.CinemachineUniversalPixelPerfect)), CanEditMultipleObjects]
internal class CinemachineUniversalPixelPerfectEditor : Editor
{
public override void OnInspectorGUI()
{
EditorGUILayout.HelpBox("This Cinemachine extension is now deprecated and doesn't function properly. Instead, use the one from Cinemachine v2.4.0 or newer.", MessageType.Error);
}
}
}

View File

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

View File

@@ -0,0 +1,13 @@
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
[CustomEditor(typeof(CompositeShadowCaster2D))]
internal class CompositeShadowCaster2DEditor : Editor
{
public override void OnInspectorGUI()
{
}
}
}

View File

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

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5361c774211d0234c94d0161651a5407
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
namespace UnityEditor.Rendering.Universal
{
internal sealed class BuiltInToURP2DConverterContainer : RenderPipelineConverterContainer
{
public override string name => "Built-in to 2D (URP)";
public override string info => "Converter performs the following tasks:\n* Converts project elements from the Built-in Render Pipeline to 2D URP.";
}
}

View File

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

View File

@@ -0,0 +1,138 @@
using System;
using System.IO;
using System.Collections.Generic;
using UnityEditor.Rendering.Universal;
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
internal sealed class BuiltInToURP2DMaterialUpgrader : RenderPipelineConverter
{
public override string name => "Material and Material Reference Upgrade";
public override string info => "This will upgrade all materials and material references.";
public override int priority => -1000;
public override Type container => typeof(BuiltInToURP2DConverterContainer);
List<string> m_AssetsToConvert = new List<string>();
Material m_SpriteLitDefaultMat;
Material m_SpritesDefaultMat;
Material m_SpritesMaskMat;
Material m_SpriteMaskDefaultMat;
Shader m_SpriteLitDefaultShader;
Shader m_SpritesDefaultShader;
string m_SpritesDefaultShaderId;
string m_SpritesDefaultMatId;
string m_SpritesMaskMatId;
void UpgradeGameObject(GameObject go)
{
Renderer[] renderers = go.GetComponentsInChildren<Renderer>();
foreach (Renderer renderer in renderers)
{
if (!PrefabUtility.IsPartOfPrefabInstance(renderer))
{
int materialCount = renderer.sharedMaterials.Length;
Material[] newMaterials = new Material[materialCount];
bool updateMaterials = false;
for (int matIndex = 0; matIndex < materialCount; matIndex++)
{
if (renderer.sharedMaterials[matIndex] == m_SpritesDefaultMat)
{
newMaterials[matIndex] = m_SpriteLitDefaultMat;
updateMaterials = true;
}
else if (renderer.sharedMaterials[matIndex] == m_SpritesMaskMat)
{
newMaterials[matIndex] = m_SpriteMaskDefaultMat;
updateMaterials = true;
}
else
newMaterials[matIndex] = renderer.sharedMaterials[matIndex];
}
if (updateMaterials)
renderer.sharedMaterials = newMaterials;
}
}
}
public override void OnInitialize(InitializeConverterContext context, Action callback)
{
Renderer2DData data = Light2DEditorUtility.GetRenderer2DData();
if (data != null)
m_SpriteLitDefaultMat = data.GetDefaultMaterial(DefaultMaterialType.Sprite);
else
m_SpriteLitDefaultMat = AssetDatabase.LoadAssetAtPath<Material>("Packages/com.unity.render-pipelines.universal/Runtime/Materials/Sprite-Lit-Default.mat");
m_SpritesDefaultMat = AssetDatabase.GetBuiltinExtraResource<Material>("Sprites-Default.mat");
m_SpriteMaskDefaultMat = AssetDatabase.LoadAssetAtPath<Material>("Packages/com.unity.render-pipelines.universal/Runtime/Materials/SpriteMask-Default.mat");
m_SpritesMaskMat = AssetDatabase.GetBuiltinExtraResource<Material>("Sprites-Mask.mat");
m_SpriteLitDefaultShader = m_SpriteLitDefaultMat.shader;
m_SpritesDefaultShader = m_SpritesDefaultMat.shader;
m_SpritesDefaultShaderId = URP2DConverterUtility.GetObjectIDString(m_SpritesDefaultShader);
m_SpritesDefaultMatId = URP2DConverterUtility.GetObjectIDString(m_SpritesDefaultMat);
m_SpritesMaskMatId = URP2DConverterUtility.GetObjectIDString(m_SpritesMaskMat);
string[] allAssetPaths = AssetDatabase.GetAllAssetPaths();
foreach (string path in allAssetPaths)
{
if (URP2DConverterUtility.IsPSB(path) || URP2DConverterUtility.IsMaterialPath(path, m_SpritesDefaultShaderId) || URP2DConverterUtility.IsPrefabOrScenePath(path, new string[] { m_SpritesDefaultMatId, m_SpritesMaskMatId }))
{
ConverterItemDescriptor desc = new ConverterItemDescriptor()
{
name = Path.GetFileNameWithoutExtension(path),
info = path,
warningMessage = String.Empty,
helpLink = String.Empty
};
// Each converter needs to add this info using this API.
m_AssetsToConvert.Add(path);
context.AddAssetToConvert(desc);
}
}
callback.Invoke();
}
public override void OnRun(ref RunItemContext context)
{
string result = string.Empty;
string ext = Path.GetExtension(context.item.descriptor.info);
if (ext == ".prefab")
result = URP2DConverterUtility.UpgradePrefab(context.item.descriptor.info, UpgradeGameObject);
else if (ext == ".unity")
URP2DConverterUtility.UpgradeScene(context.item.descriptor.info, UpgradeGameObject);
else if (ext == ".mat")
URP2DConverterUtility.UpgradeMaterial(context.item.descriptor.info, m_SpritesDefaultShader, m_SpriteLitDefaultShader);
else if (ext == ".psb" || ext == ".psd")
result = URP2DConverterUtility.UpgradePSB(context.item.descriptor.info);
if (result != string.Empty)
{
context.didFail = true;
context.info = result;
}
else
{
context.hasConverted = true;
}
}
public override void OnClicked(int index)
{
EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(m_AssetsToConvert[index]));
}
public override void OnPostRun()
{
Resources.UnloadUnusedAssets();
}
}
}

View File

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

View File

@@ -0,0 +1,135 @@
using System;
using System.IO;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering.Universal;
using UnityEditor.SceneManagement;
namespace UnityEditor.Rendering.Universal
{
internal sealed class ParametricToFreeformLightUpgrader : RenderPipelineConverter
{
const float k_EnscribedSquareDiagonalLength = 0.70710678118654752440084436210485f;
public override string name => "Parametric to Freeform Light Upgrade";
public override string info => "This will upgrade all parametric lights to freeform lights.";
public override int priority => -1000;
public override Type container => typeof(UpgradeURP2DAssetsContainer);
List<string> m_AssetsToConvert = new List<string>();
string m_Light2DId;
public static void UpgradeParametricLight(Light2D light)
{
if (light.lightType == (Light2D.LightType)Light2D.DeprecatedLightType.Parametric)
{
light.lightType = Light2D.LightType.Freeform;
// Parametric radius has to be > 0 in order mesh tessellation to be valid
if (light.shapeLightParametricRadius == 0)
light.shapeLightParametricRadius = 0.01f;
float radius = light.shapeLightParametricRadius;
float angle = light.shapeLightParametricAngleOffset;
int sides = light.shapeLightParametricSides;
var angleOffset = Mathf.PI / 2.0f + Mathf.Deg2Rad * angle;
if (sides < 3)
{
radius = k_EnscribedSquareDiagonalLength * radius;
sides = 4;
}
if (sides == 4)
{
angleOffset = Mathf.PI / 4.0f + Mathf.Deg2Rad * angle;
}
var radiansPerSide = 2 * Mathf.PI / sides;
var min = new Vector3(float.MaxValue, float.MaxValue, 0);
var max = new Vector3(float.MinValue, float.MinValue, 0);
Vector3[] shapePath = new Vector3[sides];
for (var i = 0; i < sides; i++)
{
var endAngle = (i + 1) * radiansPerSide;
var extrudeDir = new Vector3(Mathf.Cos(endAngle + angleOffset), Mathf.Sin(endAngle + angleOffset), 0);
var endPoint = radius * extrudeDir;
shapePath[i] = endPoint;
}
light.shapePath = shapePath;
light.UpdateMesh();
EditorSceneManager.MarkSceneDirty(light.gameObject.scene);
}
}
void UpgradeGameObject(GameObject go)
{
Light2D[] lights = go.GetComponentsInChildren<Light2D>();
foreach (Light2D light in lights)
{
if (light.lightType == Light2D.LightType.Parametric && !PrefabUtility.IsPartOfPrefabInstance(light))
UpgradeParametricLight(light);
}
}
public override void OnInitialize(InitializeConverterContext context, Action callback)
{
string[] allAssetPaths = AssetDatabase.GetAllAssetPaths();
foreach (string path in allAssetPaths)
{
if (URP2DConverterUtility.IsPrefabOrScenePath(path, "m_LightType: 0"))
{
ConverterItemDescriptor desc = new ConverterItemDescriptor()
{
name = Path.GetFileNameWithoutExtension(path),
info = path,
warningMessage = String.Empty,
helpLink = String.Empty
};
// Each converter needs to add this info using this API.
m_AssetsToConvert.Add(path);
context.AddAssetToConvert(desc);
}
}
callback.Invoke();
}
public override void OnRun(ref RunItemContext context)
{
string result = string.Empty;
string ext = Path.GetExtension(context.item.descriptor.info);
if (ext == ".prefab")
result = URP2DConverterUtility.UpgradePrefab(context.item.descriptor.info, UpgradeGameObject);
else if (ext == ".unity")
URP2DConverterUtility.UpgradeScene(context.item.descriptor.info, UpgradeGameObject);
if (result != string.Empty)
{
context.didFail = true;
context.info = result;
}
else
{
context.hasConverted = true;
}
}
public override void OnClicked(int index)
{
EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(m_AssetsToConvert[index]));
}
public override void OnPostRun()
{
Resources.UnloadUnusedAssets();
}
}
}

View File

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

View File

@@ -0,0 +1,160 @@
using System;
using UnityEngine;
using UnityEditor;
using System.IO;
using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
using static UnityEditor.Rendering.AnimationClipUpgrader;
internal static class URP2DConverterUtility
{
public static bool IsPSB(string path)
{
if (string.IsNullOrEmpty(path))
throw new ArgumentNullException(nameof(path));
if (path.StartsWith("Packages"))
return false;
return path.EndsWith(".psb") || path.EndsWith(".psd");
}
public static bool IsMaterialPath(string path, string id)
{
if (string.IsNullOrEmpty(path))
throw new ArgumentNullException(nameof(path));
if (path.StartsWith("Packages"))
return false;
if (path.EndsWith(".mat"))
return URP2DConverterUtility.DoesFileContainString(path, new string[] { id });
return false;
}
public static bool IsPrefabOrScenePath(string path, string[] ids)
{
if (string.IsNullOrEmpty(path))
throw new ArgumentNullException(nameof(path));
if (path.StartsWith("Packages"))
return false;
if (path.EndsWith(".prefab", StringComparison.OrdinalIgnoreCase) || path.EndsWith(".unity", StringComparison.OrdinalIgnoreCase))
return URP2DConverterUtility.DoesFileContainString(path, ids);
return false;
}
public static bool IsPrefabOrScenePath(string path, string id)
{
return IsPrefabOrScenePath(path, new string[] { id });
}
public static bool DoesFileContainString(string path, string[] strs)
{
if (strs != null && strs.Length > 0)
{
using (StreamReader file = File.OpenText(path))
{
string line;
while ((line = file.ReadLine()) != null)
{
for (int i = 0; i < strs.Length; i++)
{
if (line.Contains(strs[i]))
return true;
}
}
}
}
return false;
}
public static string UpgradePSB(string path)
{
AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceSynchronousImport | ImportAssetOptions.ForceUpdate);
return string.Empty;
}
public static string UpgradePrefab(string path, Action<GameObject> objectUpgrader)
{
UnityEngine.Object[] objects = AssetDatabase.LoadAllAssetsAtPath(path);
int firstIndex = 0;
for (int i = 0; i < objects.Length; i++)
{
if (objects[i] as GameObject)
{
firstIndex = i;
break;
}
}
// There should be no need to check this as we have already determined that there is something that needs upgrading
if (!PrefabUtility.IsPartOfImmutablePrefab(objects[firstIndex]))
{
for (int objIndex = 0; objIndex < objects.Length; objIndex++)
{
GameObject go = objects[objIndex] as GameObject;
if (go != null)
{
objectUpgrader(go);
}
}
GameObject asset = objects[firstIndex] as GameObject;
PrefabUtility.SavePrefabAsset(asset.transform.root.gameObject);
return string.Empty;
}
return "Unable to modify an immutable prefab";
}
public static void UpgradeScene(string path, Action<GameObject> objectUpgrader)
{
Scene scene = new Scene();
bool openedByUser = false;
for (int i = 0; i < SceneManager.sceneCount && !openedByUser; i++)
{
scene = SceneManager.GetSceneAt(i);
if (path == scene.path)
openedByUser = true;
}
if (!openedByUser)
scene = EditorSceneManager.OpenScene(path, OpenSceneMode.Additive);
GameObject[] gameObjects = scene.GetRootGameObjects();
foreach (GameObject go in gameObjects)
objectUpgrader(go);
EditorSceneManager.SaveScene(scene);
if (!openedByUser)
EditorSceneManager.CloseScene(scene, true);
}
public static void UpgradeMaterial(string path, Shader oldShader, Shader newShader)
{
Material material = AssetDatabase.LoadAssetAtPath<Material>(path);
if (material.shader == oldShader)
material.shader = newShader;
GUID guid = AssetDatabase.GUIDFromAssetPath(path);
AssetDatabase.SaveAssetIfDirty(guid);
}
public static string GetObjectIDString(UnityEngine.Object obj)
{
string guid;
long localId;
if (AssetDatabase.TryGetGUIDAndLocalFileIdentifier(obj.GetInstanceID(), out guid, out localId))
return "fileID: " + localId + ", guid: " + guid;
return null;
}
}

View File

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

View File

@@ -0,0 +1,8 @@
namespace UnityEditor.Rendering.Universal
{
internal sealed class UpgradeURP2DAssetsContainer : RenderPipelineConverterContainer
{
public override string name => "Upgrade 2D (URP) Assets";
public override string info => "Converter performs the following tasks:\n* Upgrades assets from earlier 2D URP versions to the current 2D URP version.";
}
}

View File

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

View File

@@ -0,0 +1,66 @@
using UnityEngine;
namespace UnityEditor.Rendering.Universal
{
internal static class FreeformPathPresets
{
public static Vector3[] CreateSquare()
{
Vector3[] returnPath = new Vector3[4]
{
new Vector3(-0.5f, -0.5f),
new Vector3(0.5f, -0.5f),
new Vector3(0.5f, 0.5f),
new Vector3(-0.5f, 0.5f)
};
return returnPath;
}
public static Vector3[] CreateIsometricDiamond()
{
Vector3[] returnPath = new Vector3[4]
{
new Vector3(-0.5f, 0.0f),
new Vector3(0.0f, -0.25f),
new Vector3(0.5f, 0.0f),
new Vector3(0.0f, 0.25f)
};
return returnPath;
}
private static Vector3[] CreateShape(int vertices, float angleOffset)
{
Vector3[] returnPath = new Vector3[vertices];
const float kRadius = 0.5f;
for (int i = 0; i < vertices; i++)
{
float angle = ((float)i * 2 * Mathf.PI / (float)vertices) + angleOffset;
float x = kRadius * Mathf.Cos(angle);
float y = kRadius * Mathf.Sin(angle);
returnPath[i] = new Vector3(x, y);
}
return returnPath;
}
public static Vector3[] CreateCircle()
{
return CreateShape(32, 0);
}
public static Vector3[] CreateHexagonFlatTop()
{
return CreateShape(6, 0);
}
public static Vector3[] CreateHexagonPointedTop()
{
return CreateShape(6, 0.5f * Mathf.PI);
}
}
}

View File

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

View File

@@ -0,0 +1,74 @@
using System;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
static class GameObjectCreation
{
const int k_PixelPerfectCameraGameObjectMenuPriority = 5;
[MenuItem("GameObject/2D Object/Pixel Perfect Camera (URP)", priority = k_PixelPerfectCameraGameObjectMenuPriority)]
static void GameObjectCreatePixelPerfectCamera(MenuCommand menuCommand)
{
var go = CreateGameObject("Pixel Perfect Camera", menuCommand, new[] { typeof(PixelPerfectCamera) });
go.GetComponent<PixelPerfectCamera>().gridSnapping = PixelPerfectCamera.GridSnapping.PixelSnapping;
go.GetComponent<Camera>().orthographic = true;
}
static public GameObject CreateGameObject(string name, MenuCommand menuCommand, params Type[] components)
{
var parent = menuCommand.context as GameObject;
var newGO = ObjectFactory.CreateGameObject(name, components);
newGO.name = name;
Selection.activeObject = newGO;
Place(newGO, parent);
if (EditorSettings.defaultBehaviorMode == EditorBehaviorMode.Mode2D)
{
var position = newGO.transform.position;
position.z = 0;
newGO.transform.position = position;
}
Undo.RegisterCreatedObjectUndo(newGO, string.Format("Create {0}", name));
return newGO;
}
internal static void Place(GameObject go, GameObject parentTransform)
{
if (parentTransform != null)
{
var transform = go.transform;
Undo.SetTransformParent(transform, parentTransform.transform, "Reparenting");
transform.localPosition = Vector3.zero;
transform.localRotation = Quaternion.identity;
transform.localScale = Vector3.one;
go.layer = parentTransform.gameObject.layer;
if (parentTransform.GetComponent<RectTransform>())
ObjectFactory.AddComponent<RectTransform>(go);
}
else
{
PlaceGameObjectInFrontOfSceneView(go);
StageUtility.PlaceGameObjectInCurrentStage(go); // may change parent
}
// Only at this point do we know the actual parent of the object and can modify its name accordingly.
GameObjectUtility.EnsureUniqueNameForSibling(go);
Undo.SetCurrentGroupName("Create " + go.name);
Selection.activeGameObject = go;
}
internal static void PlaceGameObjectInFrontOfSceneView(GameObject go)
{
var view = SceneView.lastActiveSceneView;
if (view != null)
{
view.MoveToView(go.transform);
}
}
}
}

View File

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

View File

@@ -0,0 +1,889 @@
using System.Collections.Generic;
using System.Linq;
using UnityEditor.EditorTools;
using UnityEditor.Rendering.Universal.Path2D;
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
[CustomEditor(typeof(Light2D))]
[CanEditMultipleObjects]
internal class Light2DEditor : PathComponentEditor<ScriptablePath>
{
[EditorTool("Edit Freeform Shape", typeof(Light2D))]
class FreeformShapeTool : PathEditorTool<ScriptablePath>
{
const string k_ShapePath = "m_ShapePath";
public override bool IsAvailable()
{
var light = target as Light2D;
if (light == null)
return false;
else
return base.IsAvailable() && light.lightType == Light2D.LightType.Freeform;
}
protected override IShape GetShape(Object target)
{
return (target as Light2D).shapePath.ToPolygon(false);
}
protected override void SetShape(ScriptablePath shapeEditor, SerializedObject serializedObject)
{
serializedObject.Update();
var pointsProperty = serializedObject.FindProperty(k_ShapePath);
pointsProperty.arraySize = shapeEditor.pointCount;
for (var i = 0; i < shapeEditor.pointCount; ++i)
pointsProperty.GetArrayElementAtIndex(i).vector3Value = shapeEditor.GetPoint(i).position;
((Light2D)(serializedObject.targetObject)).UpdateMesh();
// This is untracked right now...
serializedObject.ApplyModifiedProperties();
}
}
private static class Styles
{
public static readonly GUIContent InnerOuterSpotAngle = EditorGUIUtility.TrTextContent("Inner / Outer Spot Angle", "Adjusts the inner / outer angles of this light to change the angle ranges of this Spot Lights beam.");
public static Texture lightCapTopRight = Resources.Load<Texture>("LightCapTopRight");
public static Texture lightCapTopLeft = Resources.Load<Texture>("LightCapTopLeft");
public static Texture lightCapBottomLeft = Resources.Load<Texture>("LightCapBottomLeft");
public static Texture lightCapBottomRight = Resources.Load<Texture>("LightCapBottomRight");
public static Texture lightCapUp = Resources.Load<Texture>("LightCapUp");
public static Texture lightCapDown = Resources.Load<Texture>("LightCapDown");
public static GUIContent lightTypeFreeform = new GUIContent("Freeform", Resources.Load("InspectorIcons/FreeformLight") as Texture);
public static GUIContent lightTypeSprite = new GUIContent("Sprite", Resources.Load("InspectorIcons/SpriteLight") as Texture);
public static GUIContent lightTypePoint = new GUIContent("Spot", Resources.Load("InspectorIcons/PointLight") as Texture);
public static GUIContent lightTypeGlobal = new GUIContent("Global", Resources.Load("InspectorIcons/GlobalLight") as Texture);
public static GUIContent[] lightTypeOptions = new GUIContent[] { lightTypeFreeform, lightTypeSprite, lightTypePoint, lightTypeGlobal };
public static GUIContent blendingSettingsFoldout = EditorGUIUtility.TrTextContent("Blending", "Options used for blending");
public static GUIContent shadowsSettingsFoldout = EditorGUIUtility.TrTextContent("Shadows", "Options used for shadows");
public static GUIContent volumetricSettingsFoldout = EditorGUIUtility.TrTextContent("Volumetric", "Options used for volumetric lighting");
public static GUIContent normalMapsSettingsFoldout = EditorGUIUtility.TrTextContent("Normal Maps", "Options used for normal maps");
public static GUIContent generalLightType = EditorGUIUtility.TrTextContent("Light Type", "Select the light type. \n\nGlobal Light: For ambient light. \nSpot Light: For a spot light / point light. \nFreeform Light: For a custom shape light. \nSprite Light: For a custom light cookie using Sprites.");
public static GUIContent generalFalloffSize = EditorGUIUtility.TrTextContent("Falloff", "Adjusts the falloff area of this light. The higher the falloff value, the larger area the falloff spans.");
public static GUIContent generalFalloffIntensity = EditorGUIUtility.TrTextContent("Falloff Strength", "Adjusts the falloff curve to control the softness of this lights edges. The higher the falloff strength, the softer the edges of this light.");
public static GUIContent generalLightColor = EditorGUIUtility.TrTextContent("Color", "Adjusts this lights color.");
public static GUIContent generalLightIntensity = EditorGUIUtility.TrTextContent("Intensity", "Adjusts this lights color intensity by using multiply to brighten the Sprite beyond its original color.");
public static GUIContent generalVolumeIntensity = EditorGUIUtility.TrTextContent("Intensity", "Adjusts the intensity of this additional light volume that's additively blended on top of this light. To enable the Volumetric Shadow Strength, increase this Intensity to be greater than 0.");
public static GUIContent generalBlendStyle = EditorGUIUtility.TrTextContent("Blend Style", "Adjusts how this light blends with the Sprites on the Target Sorting Layers. Different Blend Styles can be customized in the 2D Renderer Data Asset.");
public static GUIContent generalLightOverlapOperation = EditorGUIUtility.TrTextContent("Overlap Operation", "Determines how this light blends with the other lights either through additive or alpha blending.");
public static GUIContent generalLightOrder = EditorGUIUtility.TrTextContent("Light Order", "Determines the relative order in which lights of the same Blend Style get rendered. Lights with lower values are rendered first.");
public static GUIContent generalShadowIntensity = EditorGUIUtility.TrTextContent("Strength", "Adjusts the amount of light occlusion from the Shadow Caster 2D component(s) when blocking this light.The higher the value, the more opaque the shadow becomes.");
public static GUIContent generalShadowSoftness = EditorGUIUtility.TrTextContent("Softness", "Adjusts the amount of softness at the edge of the shadow.");
public static GUIContent generalShadowSoftnessFalloffIntensity = EditorGUIUtility.TrTextContent("Falloff Strength", "Adjusts the falloff curve to control the softness of the shadow edges. The higher the falloff strength, the softer the edges of this shadow.");
public static GUIContent generalShadowVolumeIntensity = EditorGUIUtility.TrTextContent("Shadow Strength", "Adjusts the amount of volume light occlusion from the Shadow Caster 2D component(s) when blocking this light.");
public static GUIContent generalSortingLayerPrefixLabel = EditorGUIUtility.TrTextContent("Target Sorting Layers", "Determines which layers this light affects. To optimize performance, minimize the number of layers this light affects.");
public static GUIContent generalLightNoLightEnabled = EditorGUIUtility.TrTextContentWithIcon("No valid blend styles are enabled.", MessageType.Error);
public static GUIContent generalNormalMapZDistance = EditorGUIUtility.TrTextContent("Distance", "Adjusts the z-axis distance of this light and the lit Sprite(s). Do note that this distance does not Transform the position of this light in the Scene.");
public static GUIContent generalNormalMapLightQuality = EditorGUIUtility.TrTextContent("Quality", "Determines the accuracy of the lighting calculations when normal map is used. To optimize for performance, select Fast.");
public static GUIContent pointLightRadius = EditorGUIUtility.TrTextContent("Radius", "Adjusts the inner / outer radius of this light to change the size of this light.");
public static GUIContent pointLightInner = EditorGUIUtility.TrTextContent("Inner", "Specify the inner radius of the light");
public static GUIContent pointLightOuter = EditorGUIUtility.TrTextContent("Outer", "Specify the outer radius of the light");
public static GUIContent pointLightSprite = EditorGUIUtility.TrTextContent("Sprite", "Specify the sprite (deprecated)");
public static GUIContent shapeLightSprite = EditorGUIUtility.TrTextContent("Sprite", "Assign a Sprite which acts as a mask to create a light cookie.");
public static GUIContent deprecatedParametricLightWarningSingle = EditorGUIUtility.TrTextContentWithIcon("Parametic Lights have been deprecated. To continue, upgrade your Parametric Light to a Freeform Light to enjoy similar light functionality.", MessageType.Warning);
public static GUIContent deprecatedParametricLightWarningMulti = EditorGUIUtility.TrTextContentWithIcon("Parametic Lights have been deprecated. To continue, upgrade your Parametric Lights to Freeform Lights to enjoy similar light functionality.", MessageType.Warning);
public static GUIContent deprecatedParametricLightInstructions = EditorGUIUtility.TrTextContent("Alternatively, you may choose to upgrade from the menu. Window > Rendering > Render Pipeline Converter > URP 2D Converters");
public static GUIContent deprecatedParametricLightButtonSingle = EditorGUIUtility.TrTextContent("Upgrade Parametric Light");
public static GUIContent deprecatedParametricLightButtonMulti = EditorGUIUtility.TrTextContent("Upgrade Parametric Lights");
public static GUIContent renderPipelineUnassignedWarning = EditorGUIUtility.TrTextContentWithIcon("Universal scriptable renderpipeline asset must be assigned in Graphics Settings or Quality Settings.", MessageType.Warning);
public static GUIContent asset2DUnassignedWarning = EditorGUIUtility.TrTextContentWithIcon("2D renderer data must be assigned to your universal render pipeline asset or camera.", MessageType.Warning);
public static string deprecatedParametricLightDialogTextSingle = "The upgrade will convert the selected parametric light into a freeform light. You can't undo this operation.";
public static string deprecatedParametricLightDialogTextMulti = "The upgrade will convert the selected parametric lights into freeform lights. You can't undo this operation.";
public static string deprecatedParametricLightDialogTitle = "Parametric Light Upgrader";
public static string deprecatedParametricLightDialogProceed = "Proceed";
public static string deprecatedParametricLightDialogCancel = "Cancel";
}
const float k_GlobalLightGizmoSize = 1.2f;
const float k_AngleCapSize = 0.16f * k_GlobalLightGizmoSize;
const float k_AngleCapOffset = 0.08f * k_GlobalLightGizmoSize;
const float k_AngleCapOffsetSecondary = -0.05f;
const float k_RangeCapSize = 0.025f * k_GlobalLightGizmoSize;
const float k_InnerRangeCapSize = 0.08f * k_GlobalLightGizmoSize;
SerializedProperty m_LightType;
SerializedProperty m_LightColor;
SerializedProperty m_LightIntensity;
SerializedProperty m_UseNormalMap;
SerializedProperty m_ShadowsEnabled;
SerializedProperty m_ShadowIntensity;
SerializedProperty m_ShadowSoftness;
SerializedProperty m_ShadowSoftnessFalloffIntensity;
SerializedProperty m_ShadowVolumeIntensity;
SerializedProperty m_ShadowVolumeIntensityEnabled;
SerializedProperty m_ApplyToSortingLayers;
SerializedProperty m_VolumetricIntensity;
SerializedProperty m_VolumetricEnabled;
SerializedProperty m_BlendStyleIndex;
SerializedProperty m_FalloffIntensity;
SerializedProperty m_NormalMapZDistance;
SerializedProperty m_NormalMapQuality;
SerializedProperty m_LightOrder;
SerializedProperty m_OverlapOperation;
// Point Light Properties
SerializedProperty m_PointInnerAngle;
SerializedProperty m_PointOuterAngle;
SerializedProperty m_PointInnerRadius;
SerializedProperty m_PointOuterRadius;
SerializedProperty m_DeprecatedPointLightSprite;
// Shape Light Properties
SerializedProperty m_ShapeLightParametricRadius;
SerializedProperty m_ShapeLightFalloffSize;
SerializedProperty m_ShapeLightParametricSides;
SerializedProperty m_ShapeLightSprite;
SavedBool m_BlendingSettingsFoldout;
SavedBool m_ShadowsSettingsFoldout;
SavedBool m_VolumetricSettingsFoldout;
SavedBool m_NormalMapsSettingsFoldout;
int[] m_BlendStyleIndices;
GUIContent[] m_BlendStyleNames;
bool m_AnyBlendStyleEnabled = false;
SortingLayerDropDown m_SortingLayerDropDown;
Light2D lightObject => target as Light2D;
Analytics.Renderer2DAnalytics m_Analytics;
HashSet<Light2D> m_ModifiedLights;
private void AnalyticsTrackChanges(SerializedObject serializedObject)
{
if (serializedObject.hasModifiedProperties)
{
foreach (Object targetObj in serializedObject.targetObjects)
{
Light2D light2d = (Light2D)targetObj;
if (!m_ModifiedLights.Contains(light2d))
m_ModifiedLights.Add(light2d);
}
}
}
private void DrawHeaderFoldoutWithToggle(GUIContent title, SavedBool foldoutState, SerializedProperty toggleState, string documentationURL = "")
{
const float height = 17f;
var backgroundRect = GUILayoutUtility.GetRect(0, 0);
float xMin = backgroundRect.xMin;
var labelRect = backgroundRect;
labelRect.yMax += height;
labelRect.xMin += 16f;
labelRect.xMax -= 20f;
bool newToggleState = GUI.Toggle(labelRect, toggleState.boolValue, " "); // Needs a space because the checkbox won't have a proper outline if we don't make a space here
bool newFoldoutState = CoreEditorUtils.DrawHeaderFoldout("", foldoutState.value);
if (newToggleState != toggleState.boolValue)
toggleState.boolValue = newToggleState;
if (newFoldoutState != foldoutState.value)
foldoutState.value = newFoldoutState;
labelRect.xMin += 20;
EditorGUI.LabelField(labelRect, title, EditorStyles.boldLabel);
}
void OnEnable()
{
m_Analytics = Analytics.Renderer2DAnalytics.instance;
m_ModifiedLights = new HashSet<Light2D>();
m_SortingLayerDropDown = new SortingLayerDropDown();
m_BlendingSettingsFoldout = new SavedBool($"{target.GetType()}.2DURPBlendingSettingsFoldout", false);
m_ShadowsSettingsFoldout = new SavedBool($"{target.GetType()}.2DURPShadowsSettingsFoldout", false);
m_VolumetricSettingsFoldout = new SavedBool($"{target.GetType()}.2DURPVolumetricSettingsFoldout", false);
m_NormalMapsSettingsFoldout = new SavedBool($"{target.GetType()}.2DURPNormalMapsSettingsFoldout", false);
m_LightType = serializedObject.FindProperty("m_LightType");
m_LightColor = serializedObject.FindProperty("m_Color");
m_LightIntensity = serializedObject.FindProperty("m_Intensity");
m_UseNormalMap = serializedObject.FindProperty("m_UseNormalMap");
m_ShadowsEnabled = serializedObject.FindProperty("m_ShadowsEnabled");
m_ShadowIntensity = serializedObject.FindProperty("m_ShadowIntensity");
m_ShadowSoftness = serializedObject.FindProperty("m_ShadowSoftness");
m_ShadowSoftnessFalloffIntensity = serializedObject.FindProperty("m_ShadowSoftnessFalloffIntensity");
m_ShadowVolumeIntensity = serializedObject.FindProperty("m_ShadowVolumeIntensity");
m_ShadowVolumeIntensityEnabled = serializedObject.FindProperty("m_ShadowVolumeIntensityEnabled");
m_ApplyToSortingLayers = serializedObject.FindProperty("m_ApplyToSortingLayers");
m_VolumetricIntensity = serializedObject.FindProperty("m_LightVolumeIntensity");
m_VolumetricEnabled = serializedObject.FindProperty("m_LightVolumeEnabled");
m_BlendStyleIndex = serializedObject.FindProperty("m_BlendStyleIndex");
m_FalloffIntensity = serializedObject.FindProperty("m_FalloffIntensity");
m_NormalMapZDistance = serializedObject.FindProperty("m_NormalMapDistance");
m_NormalMapQuality = serializedObject.FindProperty("m_NormalMapQuality");
m_LightOrder = serializedObject.FindProperty("m_LightOrder");
m_OverlapOperation = serializedObject.FindProperty("m_OverlapOperation");
// Point Light
m_PointInnerAngle = serializedObject.FindProperty("m_PointLightInnerAngle");
m_PointOuterAngle = serializedObject.FindProperty("m_PointLightOuterAngle");
m_PointInnerRadius = serializedObject.FindProperty("m_PointLightInnerRadius");
m_PointOuterRadius = serializedObject.FindProperty("m_PointLightOuterRadius");
m_DeprecatedPointLightSprite = serializedObject.FindProperty("m_DeprecatedPointLightCookieSprite");
// Shape Light
m_ShapeLightParametricRadius = serializedObject.FindProperty("m_ShapeLightParametricRadius");
m_ShapeLightFalloffSize = serializedObject.FindProperty("m_ShapeLightFalloffSize");
m_ShapeLightParametricSides = serializedObject.FindProperty("m_ShapeLightParametricSides");
m_ShapeLightSprite = serializedObject.FindProperty("m_LightCookieSprite");
m_AnyBlendStyleEnabled = false;
var blendStyleIndices = new List<int>();
var blendStyleNames = new List<string>();
var rendererData = Light2DEditorUtility.GetRenderer2DData();
if (rendererData != null)
{
for (int i = 0; i < rendererData.lightBlendStyles.Length; ++i)
{
blendStyleIndices.Add(i);
ref var blendStyle = ref rendererData.lightBlendStyles[i];
if (blendStyle.maskTextureChannel == Light2DBlendStyle.TextureChannel.None)
blendStyleNames.Add(blendStyle.name);
else
{
var name = string.Format("{0} ({1})", blendStyle.name, blendStyle.maskTextureChannel);
blendStyleNames.Add(name);
}
m_AnyBlendStyleEnabled = true;
}
}
else
{
for (int i = 0; i < 4; ++i)
{
blendStyleIndices.Add(i);
blendStyleNames.Add("Operation" + i);
}
}
m_BlendStyleIndices = blendStyleIndices.ToArray();
m_BlendStyleNames = blendStyleNames.Select(x => new GUIContent(x)).ToArray();
m_SortingLayerDropDown.OnEnable(serializedObject, "m_ApplyToSortingLayers");
}
internal void SendModifiedAnalytics(Analytics.Renderer2DAnalytics analytics, Light2D light)
{
Analytics.LightDataAnalytic lightData = new Analytics.LightDataAnalytic(light.GetInstanceID(), false, light.lightType);
Analytics.Renderer2DAnalytics.instance.SendData(lightData);
}
void OnDestroy()
{
if (m_ModifiedLights != null && m_ModifiedLights.Count > 0)
{
foreach (Light2D light in m_ModifiedLights)
{
SendModifiedAnalytics(m_Analytics, light);
}
}
}
void DrawBlendingGroup()
{
CoreEditorUtils.DrawSplitter(false);
bool foldoutState = CoreEditorUtils.DrawHeaderFoldout(Styles.blendingSettingsFoldout, m_BlendingSettingsFoldout.value);
if (foldoutState != m_BlendingSettingsFoldout.value)
m_BlendingSettingsFoldout.value = foldoutState;
if (m_BlendingSettingsFoldout.value)
{
if (!m_AnyBlendStyleEnabled)
EditorGUILayout.HelpBox(Styles.generalLightNoLightEnabled);
else
EditorGUILayout.IntPopup(m_BlendStyleIndex, m_BlendStyleNames, m_BlendStyleIndices, Styles.generalBlendStyle);
EditorGUILayout.PropertyField(m_LightOrder, Styles.generalLightOrder);
EditorGUILayout.PropertyField(m_OverlapOperation, Styles.generalLightOverlapOperation);
}
}
void DrawShadowsGroup()
{
CoreEditorUtils.DrawSplitter(false);
DrawHeaderFoldoutWithToggle(Styles.shadowsSettingsFoldout, m_ShadowsSettingsFoldout, m_ShadowsEnabled);
if (m_ShadowsSettingsFoldout.value)
{
EditorGUI.indentLevel++;
EditorGUI.BeginDisabledGroup(!m_ShadowsEnabled.boolValue);
EditorGUILayout.PropertyField(m_ShadowIntensity, Styles.generalShadowIntensity);
EditorGUILayout.PropertyField(m_ShadowSoftness, Styles.generalShadowSoftness);
EditorGUILayout.PropertyField(m_ShadowSoftnessFalloffIntensity,Styles.generalShadowSoftnessFalloffIntensity);
EditorGUI.EndDisabledGroup();
EditorGUI.indentLevel--;
}
}
void DrawVolumetricGroup()
{
CoreEditorUtils.DrawSplitter(false);
DrawHeaderFoldoutWithToggle(Styles.volumetricSettingsFoldout, m_VolumetricSettingsFoldout, m_VolumetricEnabled);
if (m_VolumetricSettingsFoldout.value)
{
EditorGUI.indentLevel++;
EditorGUI.BeginDisabledGroup(!m_VolumetricEnabled.boolValue);
EditorGUILayout.PropertyField(m_VolumetricIntensity, Styles.generalVolumeIntensity);
if (m_VolumetricIntensity.floatValue < 0)
m_VolumetricIntensity.floatValue = 0;
DrawToggleProperty(Styles.generalShadowVolumeIntensity, m_ShadowVolumeIntensityEnabled, m_ShadowVolumeIntensity);
EditorGUI.EndDisabledGroup();
EditorGUI.indentLevel--;
}
}
void DrawNormalMapGroup()
{
CoreEditorUtils.DrawSplitter(false);
bool foldoutState = CoreEditorUtils.DrawHeaderFoldout(Styles.normalMapsSettingsFoldout, m_NormalMapsSettingsFoldout.value);
if (foldoutState != m_NormalMapsSettingsFoldout.value)
m_NormalMapsSettingsFoldout.value = foldoutState;
if (m_NormalMapsSettingsFoldout.value)
{
EditorGUILayout.PropertyField(m_NormalMapQuality, Styles.generalNormalMapLightQuality);
EditorGUI.BeginDisabledGroup(m_NormalMapQuality.intValue == (int)Light2D.NormalMapQuality.Disabled);
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(m_NormalMapZDistance, Styles.generalNormalMapZDistance);
if (EditorGUI.EndChangeCheck())
m_NormalMapZDistance.floatValue = Mathf.Max(0.0f, m_NormalMapZDistance.floatValue);
EditorGUI.EndDisabledGroup();
}
}
void DrawFoldouts()
{
DrawBlendingGroup();
DrawShadowsGroup();
DrawVolumetricGroup();
DrawNormalMapGroup();
}
void DrawRadiusProperties(GUIContent label, SerializedProperty innerRadius, GUIContent content1, SerializedProperty outerRadius, GUIContent content2)
{
GUIStyle style = GUI.skin.box;
float savedLabelWidth = EditorGUIUtility.labelWidth;
int savedIndentLevel = EditorGUI.indentLevel;
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel(label);
EditorGUILayout.BeginHorizontal();
EditorGUI.indentLevel = 0;
EditorGUIUtility.labelWidth = style.CalcSize(content1).x;
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(innerRadius, content1);
if (EditorGUI.EndChangeCheck())
{
if (innerRadius.floatValue > outerRadius.floatValue)
innerRadius.floatValue = outerRadius.floatValue;
else if (innerRadius.floatValue < 0)
innerRadius.floatValue = 0;
}
EditorGUIUtility.labelWidth = style.CalcSize(content2).x;
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(outerRadius, content2);
if (EditorGUI.EndChangeCheck() && outerRadius.floatValue < innerRadius.floatValue)
outerRadius.floatValue = innerRadius.floatValue;
EditorGUILayout.EndHorizontal();
EditorGUILayout.EndHorizontal();
EditorGUIUtility.labelWidth = savedLabelWidth;
EditorGUI.indentLevel = savedIndentLevel;
}
void DrawToggleProperty(GUIContent label, SerializedProperty boolProperty, SerializedProperty property)
{
int savedIndentLevel = EditorGUI.indentLevel;
float savedLabelWidth = EditorGUIUtility.labelWidth;
const int kCheckboxWidth = 20;
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(boolProperty, GUIContent.none, GUILayout.MaxWidth(kCheckboxWidth));
EditorGUIUtility.labelWidth = EditorGUIUtility.labelWidth - kCheckboxWidth;
EditorGUI.BeginDisabledGroup(!boolProperty.boolValue);
EditorGUILayout.PropertyField(property, label);
EditorGUI.EndDisabledGroup();
EditorGUILayout.EndHorizontal();
EditorGUI.indentLevel = savedIndentLevel;
EditorGUIUtility.labelWidth = savedLabelWidth;
}
public void DrawInnerAndOuterSpotAngle(SerializedProperty minProperty, SerializedProperty maxProperty, GUIContent label)
{
float textFieldWidth = 45f;
float min = minProperty.floatValue;
float max = maxProperty.floatValue;
var rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight);
// This widget is a little bit of a special case.
// The right hand side of the min max slider will control the reset of the max value
// The left hand side of the min max slider will control the reset of the min value
// The label itself will not have a right click and reset value.
rect = EditorGUI.PrefixLabel(rect, label);
EditorGUI.BeginProperty(new Rect(rect) { width = rect.width * 0.5f }, label, minProperty);
EditorGUI.BeginProperty(new Rect(rect) { xMin = rect.x + rect.width * 0.5f }, GUIContent.none, maxProperty);
var minRect = new Rect(rect) { width = textFieldWidth };
var maxRect = new Rect(rect) { xMin = rect.xMax - textFieldWidth };
var sliderRect = new Rect(rect) { xMin = minRect.xMax + 4, xMax = maxRect.xMin - 4 };
EditorGUI.BeginChangeCheck();
EditorGUI.DelayedFloatField(minRect, minProperty, GUIContent.none);
if (EditorGUI.EndChangeCheck())
{
if (minProperty.floatValue > maxProperty.floatValue)
minProperty.floatValue = maxProperty.floatValue;
else if (minProperty.floatValue < 0)
minProperty.floatValue = 0;
}
EditorGUI.BeginChangeCheck();
EditorGUI.MinMaxSlider(sliderRect, ref min, ref max, 0f, 360f);
if (EditorGUI.EndChangeCheck())
{
minProperty.floatValue = min;
maxProperty.floatValue = max;
}
EditorGUI.BeginChangeCheck();
EditorGUI.DelayedFloatField(maxRect, m_PointOuterAngle, GUIContent.none);
if (EditorGUI.EndChangeCheck())
{
if (minProperty.floatValue > maxProperty.floatValue)
maxProperty.floatValue = minProperty.floatValue;
else if (maxProperty.floatValue > 360)
maxProperty.floatValue = 360;
}
EditorGUI.EndProperty();
EditorGUI.EndProperty();
}
void DrawGlobalLight(SerializedObject serializedObject)
{
m_SortingLayerDropDown.OnTargetSortingLayers(serializedObject, targets, Styles.generalSortingLayerPrefixLabel, AnalyticsTrackChanges);
DrawBlendingGroup();
}
void DrawParametricDeprecated(SerializedObject serializedObject)
{
GUIContent buttonText = targets.Length > 1 ? Styles.deprecatedParametricLightButtonMulti : Styles.deprecatedParametricLightButtonSingle;
GUIContent helpText = targets.Length > 1 ? Styles.deprecatedParametricLightWarningMulti : Styles.deprecatedParametricLightWarningSingle;
string dialogText = targets.Length > 1 ? Styles.deprecatedParametricLightDialogTextMulti : Styles.deprecatedParametricLightDialogTextSingle;
EditorGUILayout.HelpBox(helpText);
EditorGUILayout.Space();
if (GUILayout.Button(buttonText))
{
if (EditorUtility.DisplayDialog(Styles.deprecatedParametricLightDialogTitle, dialogText, Styles.deprecatedParametricLightDialogProceed, Styles.deprecatedParametricLightDialogCancel))
{
for (int i = 0; i < targets.Length; i++)
{
Light2D light = (Light2D)targets[i];
if (light.lightType == (Light2D.LightType)Light2D.DeprecatedLightType.Parametric)
ParametricToFreeformLightUpgrader.UpgradeParametricLight(light);
}
}
}
EditorGUILayout.Space();
EditorGUILayout.HelpBox(Styles.deprecatedParametricLightInstructions);
}
bool DrawLightCommon()
{
var meshChanged = false;
Rect lightTypeRect = EditorGUILayout.GetControlRect();
EditorGUI.BeginProperty(lightTypeRect, GUIContent.none, m_LightType);
EditorGUI.BeginChangeCheck();
int newLightType = EditorGUI.Popup(lightTypeRect, Styles.generalLightType, m_LightType.intValue - 1, Styles.lightTypeOptions); // -1 is a bit hacky its to support compatibiltiy. We need something better.
if (EditorGUI.EndChangeCheck())
{
m_LightType.intValue = newLightType + 1; // -1 is a bit hacky its to support compatibiltiy. We need something better.
meshChanged = true;
}
EditorGUI.EndProperty();
// Color and intensity
EditorGUILayout.PropertyField(m_LightColor, Styles.generalLightColor);
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(m_LightIntensity, Styles.generalLightIntensity);
if (EditorGUI.EndChangeCheck())
m_LightIntensity.floatValue = Mathf.Max(m_LightIntensity.floatValue, 0);
return meshChanged;
}
void DrawSpotLight(SerializedObject serializedObject)
{
DrawRadiusProperties(Styles.pointLightRadius, m_PointInnerRadius, Styles.pointLightInner, m_PointOuterRadius, Styles.pointLightOuter);
DrawInnerAndOuterSpotAngle(m_PointInnerAngle, m_PointOuterAngle, Styles.InnerOuterSpotAngle);
EditorGUILayout.Slider(m_FalloffIntensity, 0, 1, Styles.generalFalloffIntensity);
if (m_DeprecatedPointLightSprite.objectReferenceValue != null)
EditorGUILayout.PropertyField(m_DeprecatedPointLightSprite, Styles.pointLightSprite);
m_SortingLayerDropDown.OnTargetSortingLayers(serializedObject, targets, Styles.generalSortingLayerPrefixLabel, AnalyticsTrackChanges);
DrawFoldouts();
}
void DrawSpriteLight(SerializedObject serializedObject)
{
EditorGUILayout.PropertyField(m_ShapeLightSprite, Styles.shapeLightSprite);
m_SortingLayerDropDown.OnTargetSortingLayers(serializedObject, targets, Styles.generalSortingLayerPrefixLabel, AnalyticsTrackChanges);
DrawFoldouts();
}
void DrawShapeLight(SerializedObject serializedObject)
{
EditorGUILayout.PropertyField(m_ShapeLightFalloffSize, Styles.generalFalloffSize);
if (m_ShapeLightFalloffSize.floatValue < 0)
m_ShapeLightFalloffSize.floatValue = 0;
EditorGUILayout.Slider(m_FalloffIntensity, 0, 1, Styles.generalFalloffIntensity);
m_SortingLayerDropDown.OnTargetSortingLayers(serializedObject, targets, Styles.generalSortingLayerPrefixLabel, AnalyticsTrackChanges);
if (m_LightType.intValue == (int)Light2D.LightType.Freeform)
{
DoEditButton<FreeformShapeTool>(PathEditorToolContents.icon, "Edit Shape");
DoPathInspector<FreeformShapeTool>();
DoSnappingInspector<FreeformShapeTool>();
}
DrawFoldouts();
}
Vector3 DrawAngleSlider2D(Transform transform, Quaternion rotation, float radius, float offset, Handles.CapFunction capFunc, float capSize, bool leftAngle, bool drawLine, bool useCapOffset, ref float angle)
{
float oldAngle = angle;
float angleBy2 = (angle / 2) * (leftAngle ? -1.0f : 1.0f);
Vector3 trcwPos = Quaternion.AngleAxis(angleBy2, -transform.forward) * (transform.up);
Vector3 cwPos = transform.position + trcwPos * (radius + offset);
float direction = leftAngle ? 1 : -1;
// Offset the handle
float size = .25f * capSize;
Vector3 handleOffset = useCapOffset ? rotation * new Vector3(direction * size, 0, 0) : Vector3.zero;
EditorGUI.BeginChangeCheck();
var id = GUIUtility.GetControlID("AngleSlider".GetHashCode(), FocusType.Passive);
Vector3 cwHandle = Handles.Slider2D(id, cwPos, handleOffset, Vector3.forward, rotation * Vector3.up, rotation * Vector3.right, capSize, capFunc, Vector3.zero);
if (EditorGUI.EndChangeCheck())
{
Vector3 toCwHandle = (transform.position - cwHandle).normalized;
angle = 360 - 2 * Quaternion.Angle(Quaternion.FromToRotation(transform.up, toCwHandle), Quaternion.identity);
angle = Mathf.Round(angle * 100) / 100f;
float side = Vector3.Dot(direction * transform.right, toCwHandle);
if (side < 0)
{
if (oldAngle < 180)
angle = 0;
else
angle = 360;
}
}
if (drawLine)
Handles.DrawLine(transform.position, cwHandle);
return cwHandle;
}
private float DrawAngleHandle(Transform transform, float radius, float offset, Handles.CapFunction capLeft, Handles.CapFunction capRight, ref float angle)
{
float old = angle;
float handleOffset = HandleUtility.GetHandleSize(transform.position) * offset;
float handleSize = HandleUtility.GetHandleSize(transform.position) * k_AngleCapSize;
Quaternion rotLt = Quaternion.AngleAxis(-angle / 2, -transform.forward) * transform.rotation;
DrawAngleSlider2D(transform, rotLt, radius, handleOffset, capLeft, handleSize, true, true, true, ref angle);
Quaternion rotRt = Quaternion.AngleAxis(angle / 2, -transform.forward) * transform.rotation;
DrawAngleSlider2D(transform, rotRt, radius, handleOffset, capRight, handleSize, false, true, true, ref angle);
return angle - old;
}
private void DrawRadiusArc(Transform transform, float radius, float angle, int steps, Handles.CapFunction capFunc, float capSize, bool even)
{
Handles.DrawWireArc(transform.position, transform.forward, Quaternion.AngleAxis(180 - angle / 2, transform.forward) * -transform.up, angle, radius);
}
Handles.CapFunction GetCapFunc(Texture texture, bool isAngleHandle)
{
return (controlID, position, rotation, size, eventType) => Light2DEditorUtility.GUITextureCap(controlID, texture, position, rotation, size, eventType, isAngleHandle);
}
private void DrawAngleHandles(Light2D light)
{
var oldColor = Handles.color;
Handles.color = Color.yellow;
float outerAngle = light.pointLightOuterAngle;
float diff = DrawAngleHandle(light.transform, light.pointLightOuterRadius, k_AngleCapOffset, GetCapFunc(Styles.lightCapTopRight, true), GetCapFunc(Styles.lightCapBottomRight, true), ref outerAngle);
light.pointLightOuterAngle = outerAngle;
if (diff != 0.0f)
light.pointLightInnerAngle = Mathf.Max(0.0f, light.pointLightInnerAngle + diff);
float innerAngle = light.pointLightInnerAngle;
diff = DrawAngleHandle(light.transform, light.pointLightOuterRadius, -k_AngleCapOffset, GetCapFunc(Styles.lightCapTopLeft, true), GetCapFunc(Styles.lightCapBottomLeft, true), ref innerAngle);
light.pointLightInnerAngle = innerAngle;
if (diff != 0.0f)
light.pointLightInnerAngle = light.pointLightInnerAngle < light.pointLightOuterAngle ? light.pointLightInnerAngle : light.pointLightOuterAngle;
light.pointLightInnerAngle = Mathf.Min(light.pointLightInnerAngle, light.pointLightOuterAngle);
Handles.color = oldColor;
}
private void DrawRangeHandles(Light2D light)
{
var dummy = 0.0f;
bool radiusChanged = false;
Vector3 handlePos = Vector3.zero;
Quaternion rotLeft = Quaternion.AngleAxis(0, -light.transform.forward) * light.transform.rotation;
float handleOffset = HandleUtility.GetHandleSize(light.transform.position) * k_AngleCapOffsetSecondary;
float handleSize = HandleUtility.GetHandleSize(light.transform.position) * k_AngleCapSize;
var oldColor = Handles.color;
Handles.color = Color.yellow;
float outerRadius = light.pointLightOuterRadius;
EditorGUI.BeginChangeCheck();
Vector3 returnPos = DrawAngleSlider2D(light.transform, rotLeft, outerRadius, -handleOffset, GetCapFunc(Styles.lightCapUp, false), handleSize, false, false, false, ref dummy);
if (EditorGUI.EndChangeCheck())
{
var vec = (returnPos - light.transform.position).normalized;
light.transform.up = new Vector3(vec.x, vec.y, 0);
outerRadius = (returnPos - light.transform.position).magnitude;
outerRadius = outerRadius + handleOffset;
radiusChanged = true;
}
DrawRadiusArc(light.transform, light.pointLightOuterRadius, light.pointLightOuterAngle, 0, Handles.DotHandleCap, k_RangeCapSize, false);
Handles.color = Color.gray;
float innerRadius = light.pointLightInnerRadius;
EditorGUI.BeginChangeCheck();
returnPos = DrawAngleSlider2D(light.transform, rotLeft, innerRadius, handleOffset, GetCapFunc(Styles.lightCapDown, false), handleSize, true, false, false, ref dummy);
if (EditorGUI.EndChangeCheck())
{
innerRadius = (returnPos - light.transform.position).magnitude;
innerRadius = innerRadius - handleOffset;
radiusChanged = true;
}
DrawRadiusArc(light.transform, light.pointLightInnerRadius, light.pointLightOuterAngle, 0, Handles.SphereHandleCap, k_InnerRangeCapSize, false);
Handles.color = oldColor;
if (radiusChanged)
{
light.pointLightInnerRadius = (outerRadius < innerRadius) ? outerRadius : innerRadius;
light.pointLightOuterRadius = (innerRadius > outerRadius) ? innerRadius : outerRadius;
}
}
void OnSceneGUI()
{
var light = target as Light2D;
if (light == null)
return;
Transform t = light.transform;
switch (light.lightType)
{
case Light2D.LightType.Point:
{
Undo.RecordObject(light.transform, "Edit Point Light Transform");
Undo.RecordObject(light, "Edit Point Light");
DrawRangeHandles(light);
DrawAngleHandles(light);
if (GUI.changed)
EditorUtility.SetDirty(light);
}
break;
case Light2D.LightType.Sprite:
{
var cookieSprite = light.lightCookieSprite;
if (cookieSprite != null)
{
Vector3 min = cookieSprite.bounds.min;
Vector3 max = cookieSprite.bounds.max;
Vector3 v0 = t.TransformPoint(new Vector3(min.x, min.y));
Vector3 v1 = t.TransformPoint(new Vector3(max.x, min.y));
Vector3 v2 = t.TransformPoint(new Vector3(max.x, max.y));
Vector3 v3 = t.TransformPoint(new Vector3(min.x, max.y));
Handles.DrawLine(v0, v1);
Handles.DrawLine(v1, v2);
Handles.DrawLine(v2, v3);
Handles.DrawLine(v3, v0);
}
}
break;
case Light2D.LightType.Freeform:
{
// Draw the falloff shape's outline
List<Vector2> falloffShape = light.GetFalloffShape();
Handles.color = Color.white;
for (int i = 0; i < falloffShape.Count - 1; ++i)
{
Handles.DrawLine(t.TransformPoint(falloffShape[i]), t.TransformPoint(falloffShape[i + 1]));
}
if (falloffShape.Count > 0)
Handles.DrawLine(t.TransformPoint(falloffShape[falloffShape.Count - 1]), t.TransformPoint(falloffShape[0]));
for (int i = 0; i < light.shapePath.Length - 1; ++i)
{
Handles.DrawLine(t.TransformPoint(light.shapePath[i]),
t.TransformPoint(light.shapePath[i + 1]));
}
if (light.shapePath.Length > 0)
Handles.DrawLine(t.TransformPoint(light.shapePath[light.shapePath.Length - 1]), t.TransformPoint(light.shapePath[0]));
}
break;
}
}
public override void OnInspectorGUI()
{
var meshChanged = false;
serializedObject.Update();
UniversalRenderPipelineAsset asset = UniversalRenderPipeline.asset;
if (asset != null)
{
if (!Light2DEditorUtility.IsUsing2DRenderer())
{
EditorGUILayout.HelpBox(Styles.asset2DUnassignedWarning);
}
else
{
if (m_LightType.intValue != (int)Light2D.DeprecatedLightType.Parametric)
meshChanged = DrawLightCommon();
switch (m_LightType.intValue)
{
case (int)Light2D.LightType.Point:
{
DrawSpotLight(serializedObject);
}
break;
case (int)Light2D.LightType.Freeform:
{
DrawShapeLight(serializedObject);
}
break;
case (int)Light2D.LightType.Sprite:
{
DrawSpriteLight(serializedObject);
}
break;
case (int)Light2D.LightType.Global:
{
DrawGlobalLight(serializedObject);
}
break;
case (int)Light2D.DeprecatedLightType.Parametric:
{
DrawParametricDeprecated(serializedObject);
}
break;
}
AnalyticsTrackChanges(serializedObject);
if (serializedObject.ApplyModifiedProperties())
{
if (meshChanged)
lightObject.UpdateMesh();
}
}
}
else
{
EditorGUILayout.HelpBox(Styles.renderPipelineUnassignedWarning);
if (meshChanged)
lightObject.UpdateMesh();
}
}
}
internal class Light2DPostProcess : AssetPostprocessor
{
void OnPostprocessSprites(Texture2D texture, Sprite[] sprites)
{
var lights = Resources.FindObjectsOfTypeAll<Light2D>().Where(x => x.lightType == Light2D.LightType.Sprite && x.lightCookieSprite == null);
foreach (var light in lights)
light.MarkForUpdate();
}
}
}

View File

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

View File

@@ -0,0 +1,124 @@
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
internal static class Light2DEditorUtility
{
static Material s_TexCapMaterial = CoreUtils.CreateEngineMaterial(Shader.Find("Hidden/Internal-GUITexture"));
static Mesh k_MeshQuad_Cache;
static Mesh k_MeshQuad => k_MeshQuad_Cache == null || k_MeshQuad_Cache.Equals(null) ? (k_MeshQuad_Cache = Resources.GetBuiltinResource<Mesh>("Quad.fbx")) : k_MeshQuad_Cache;
static internal void GUITextureCap(int controlID, Texture texture, Vector3 position, Quaternion rotation, float size, EventType eventType, bool isAngleHandle)
{
switch (eventType)
{
case (EventType.Layout):
{
Vector2 size2 = Vector2.one * size * 0.5f;
if (isAngleHandle)
size2.x = 0.0f;
HandleUtility.AddControl(controlID, DistanceToRectangle(position, rotation, size2));
break;
}
case (EventType.Repaint):
{
s_TexCapMaterial.mainTexture = texture;
s_TexCapMaterial.SetPass(0);
float w = texture.width;
float h = texture.height;
float max = Mathf.Max(w, h);
Vector3 scale = new Vector2(w / max, h / max) * size * 0.5f;
if (Camera.current == null)
scale.y *= -1f;
Matrix4x4 matrix = new Matrix4x4();
matrix.SetTRS(position, rotation, scale);
Graphics.DrawMeshNow(k_MeshQuad, matrix);
}
break;
}
}
static float DistanceToRectangle(Vector3 position, Quaternion rotation, Vector2 size)
{
Vector3[] points = { Vector3.zero, Vector3.zero, Vector3.zero, Vector3.zero, Vector3.zero };
Vector3 sideways = rotation * new Vector3(size.x, 0, 0);
Vector3 up = rotation * new Vector3(0, size.y, 0);
points[0] = HandleUtility.WorldToGUIPoint(position + sideways + up);
points[1] = HandleUtility.WorldToGUIPoint(position + sideways - up);
points[2] = HandleUtility.WorldToGUIPoint(position - sideways - up);
points[3] = HandleUtility.WorldToGUIPoint(position - sideways + up);
points[4] = points[0];
Vector2 pos = Event.current.mousePosition;
bool oddNodes = false;
int j = 4;
for (int i = 0; i < 5; ++i)
{
if ((points[i].y > pos.y) != (points[j].y > pos.y))
{
if (pos.x < (points[j].x - points[i].x) * (pos.y - points[i].y) / (points[j].y - points[i].y) + points[i].x)
oddNodes = !oddNodes;
}
j = i;
}
if (!oddNodes)
{
// Distance to closest edge (not so fast)
float dist, closestDist = -1f;
j = 1;
for (int i = 0; i < 4; ++i)
{
dist = HandleUtility.DistancePointToLineSegment(pos, points[i], points[j++]);
if (dist < closestDist || closestDist < 0)
closestDist = dist;
}
return closestDist;
}
else
return 0;
}
public static Renderer2DData GetRenderer2DData()
{
UniversalRenderPipelineAsset pipelineAsset = UniversalRenderPipeline.asset;
if (pipelineAsset == null)
return null;
// try get the default
Renderer2DData rendererData = pipelineAsset.scriptableRendererData as Renderer2DData;
if (rendererData == null)
{
foreach (Camera camera in Camera.allCameras)
{
UniversalAdditionalCameraData additionalCameraData = camera.GetComponent<UniversalAdditionalCameraData>();
ScriptableRenderer renderer = additionalCameraData?.scriptableRenderer;
Renderer2D renderer2D = renderer as Renderer2D;
if (renderer2D != null)
return renderer2D.GetRenderer2DData();
}
}
return rendererData;
}
public static bool IsUsing2DRenderer()
{
return GetRenderer2DData() != null;
}
}
}

View File

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

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bf4452fea996a7a468c7d5443cf2ff2e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,12 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<Style src="project://database/Assets/LightBatchingDebugger/LightBatchingDebugger.uss?fileID=7433441132597879392&amp;guid=fd5cb3dd3de574f1585db92b6689f86a&amp;type=3#LightBatchingDebugger" />
<ui:VisualElement class="BatchList BatchContainer">
<ui:Label name="BatchIndex" class="BatchList IndexColumn Batch" />
<ui:VisualElement name="BatchColor" class="BatchList ColorColumn" />
<ui:VisualElement name="LayerNames" class="BatchList NameColumn Batch" />
</ui:VisualElement>
</ui:UXML>

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 754a67c6d4788447895a4349508b2f37
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}

View File

@@ -0,0 +1,500 @@
using System;
using System.Linq;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Accessibility;
using UnityEngine.Rendering.Universal;
using UnityEngine.SceneManagement;
using UnityEngine.UIElements;
namespace UnityEditor.Rendering.Universal
{
internal class LightBatchingDebugger : EditorWindow
{
private const string ResourcePath = "Packages/com.unity.render-pipelines.universal/Editor/2D/LightBatchingDebugger/";
private class LayerBatch
{
public List<string> LayerNames = new List<string>();
public List<UnityEngine.Object> Lights = new List<UnityEngine.Object>();
public List<UnityEngine.Object> Shadows = new List<UnityEngine.Object>();
public int batchId;
}
[MenuItem("Window/2D/Light Batching Debugger")]
public static void ShowExample()
{
// Open Game View
EditorApplication.ExecuteMenuItem("Window/General/Game");
LightBatchingDebugger wnd = GetWindow<LightBatchingDebugger>();
wnd.titleContent = new GUIContent("Light Batching Debugger");
}
VisualElement root => rootVisualElement;
private static Color[] batchColors = new Color[10];
private List<LayerBatch> batchList = new List<LayerBatch>();
private List<int> selectedIndices = new List<int>();
private ListView batchListView;
private int lightCount = 0;
private int shadowCount = 0;
// Variables used for refresh view
private bool doRefresh;
private int cachedSceneHandle;
private int totalLightCount;
private int totalShadowCount;
private Vector3 cachedCamPos;
ILight2DCullResult lightCullResult
{
get
{
return renderer2DData?.lightCullResult;
}
}
Renderer2DData renderer2DData
{
get
{
// Game view main camera
var renderer = Camera.main?.GetUniversalAdditionalCameraData().scriptableRenderer as Renderer2D;
return renderer?.GetRenderer2DData();
}
}
private bool PopulateData()
{
if (lightCullResult == null)
return false;
batchList.Clear();
var layers = Light2DManager.GetCachedSortingLayer();
var batches = LayerUtility.CalculateBatches(renderer2DData, out var batchCount);
for (var i = 0; i < batchCount; i++)
{
var batchInfo = new LayerBatch
{
batchId = i
};
var batch = batches[i];
// Get the lights
foreach (var light in lightCullResult.visibleLights)
{
// If the lit layers are different, or if they are lit but this is a shadow casting light then don't batch.
if (light.IsLitLayer(batch.startLayerID))
{
batchInfo.Lights.Add(light);
}
}
// Get the shadows
var visibleShadows = lightCullResult.visibleShadows.SelectMany(x => x.GetShadowCasters());
foreach (var shadowCaster in visibleShadows)
{
if (shadowCaster.IsShadowedLayer(batch.startLayerID))
batchInfo.Shadows.Add(shadowCaster);
}
for (var batchIndex = batch.startIndex; batchIndex <= batch.endIndex; batchIndex++)
{
batchInfo.LayerNames.Add(layers[batchIndex].name);
}
batchList.Add(batchInfo);
}
return true;
}
private VisualElement MakePill(UnityEngine.Object obj)
{
var bubble = new Button();
bubble.AddToClassList("Pill");
bubble.text = obj.name;
bubble.clicked += () =>
{
Selection.activeObject = obj;
};
return bubble;
}
private VisualElement GetInfoView()
{
// Hide initial prompt
DisplayInitialPrompt(false);
return root.Query<VisualElement>("InfoView").First();
}
private void ViewBatch(int index)
{
if (index >= batchList.Count())
return;
var infoView = GetInfoView();
var batch1 = batchList[index];
var title = root.Query<Label>("InfoTitle").First();
title.text = $"<b>Batch {batch1.batchId}</b>" + " selected. Select any two adjacent batches to compare.";
var title2 = root.Query<Label>("InfoTitle2").First();
title2.text = "";
// Add Light Pill VisualElements
var lightLabel1 = infoView.Query<Label>("LightLabel1").First();
lightLabel1.text = $"Lights in <b>Batch {batch1.batchId}:</b>";
if (batch1.Lights.Count() == 0)
lightLabel1.text += "\n\nNo lights found.";
var lightBubble1 = infoView.Query<VisualElement>("LightBubble1").First();
lightBubble1.Clear();
foreach (var obj in batch1.Lights)
{
if (obj != null)
lightBubble1.Add(MakePill(obj));
}
var lightLabel2 = infoView.Query<Label>("LightLabel2").First();
lightLabel2.text = "";
var lightBubble2 = infoView.Query<VisualElement>("LightBubble2").First();
lightBubble2.Clear();
// Add Shadow Caster Pill VisualElements
var shadowLabel1 = infoView.Query<Label>("ShadowLabel1").First();
shadowLabel1.text = $"Shadow Casters in <b>Batch {batch1.batchId}:</b>";
if (batch1.Shadows.Count() == 0)
shadowLabel1.text += "\n\nNo shadow casters found.";
var shadowBubble1 = infoView.Query<VisualElement>("ShadowBubble1").First();
shadowBubble1.Clear();
foreach (var obj in batch1.Shadows)
{
if (obj != null)
shadowBubble1.Add(MakePill(obj));
}
var shadowLabel2 = infoView.Query<Label>("ShadowLabel2").First();
shadowLabel2.text = "";
var shadowBubble2 = infoView.Query<VisualElement>("ShadowBubble2").First();
shadowBubble2.Clear();
lightCount = batch1.Lights.Count;
shadowCount = batch1.Shadows.Count;
}
private void CompareBatch(int index1, int index2)
{
// Each editor window contains a root VisualElement object
var infoView = GetInfoView();
LayerBatch batch1;
LayerBatch batch2;
if (batchList[index1].batchId < batchList[index2].batchId)
{
batch1 = batchList[index1];
batch2 = batchList[index2];
}
else
{
batch1 = batchList[index2];
batch2 = batchList[index1];
}
// Do batch comparisons
var lightSet1 = batch1.Lights.Except(batch2.Lights);
var lightSet2 = batch2.Lights.Except(batch1.Lights);
var shadowSet1 = batch1.Shadows.Except(batch2.Shadows);
var shadowSet2 = batch2.Shadows.Except(batch1.Shadows);
// Change InfoTitle description when comparing batches
var title = root.Query<Label>("InfoTitle").First();
title.text = $"Comparing <b>Batch {batch1.batchId}</b> and <b>Batch {batch2.batchId}</b>.";
var title2 = root.Query<Label>("InfoTitle2").First();
title2.text = $"To batch <b>Batch {batch1.batchId}</b> and <b>Batch {batch2.batchId}</b>, ensure that the Sorting Layers in both batches share the same set of Lights and Shadow Casters.";
// Light batch comparison
var lightLabel1 = infoView.Query<Label>("LightLabel1").First();
lightLabel1.text = $"Lights only in <b>Batch {batch1.batchId}:</b>";
if (lightSet1.Count() == 0)
lightLabel1.text += "\n\nNo lights found.";
var lightBubble1 = infoView.Query<VisualElement>("LightBubble1").First();
lightBubble1.Clear();
foreach (var obj in lightSet1)
{
if (obj != null)
lightBubble1.Add(MakePill(obj));
}
var lightLabel2 = infoView.Query<Label>("LightLabel2").First();
lightLabel2.text = $"Lights only in <b>Batch {batch2.batchId}:</b>";
if (lightSet2.Count() == 0)
lightLabel2.text += "\n\nNo lights found.";
var lightBubble2 = infoView.Query<VisualElement>("LightBubble2").First();
lightBubble2.Clear();
foreach (var obj in lightSet2)
{
if (obj != null)
lightBubble2.Add(MakePill(obj));
}
// Shadow caster batch comparison
var shadowLabel1 = infoView.Query<Label>("ShadowLabel1").First();
shadowLabel1.text = $"Shadow Casters only in <b>Batch {batch1.batchId}:</b>";
if (shadowSet1.Count() == 0)
shadowLabel1.text += "\n\nNo shadow casters found.";
var shadowBubble1 = infoView.Query<VisualElement>("ShadowBubble1").First();
shadowBubble1.Clear();
foreach (var obj in shadowSet1)
{
if (obj != null)
shadowBubble1.Add(MakePill(obj));
}
var shadowLabel2 = infoView.Query<Label>("ShadowLabel2").First();
shadowLabel2.text = $"Shadow Casters only in <b>Batch {batch2.batchId}:</b>";
if (shadowSet2.Count() == 0)
shadowLabel2.text += "\n\nNo shadow casters found.";
var shadowBubble2 = infoView.Query<VisualElement>("ShadowBubble2").First();
shadowBubble2.Clear();
foreach (var obj in shadowSet2)
{
if (obj != null)
shadowBubble2.Add(MakePill(obj));
}
lightCount = lightSet1.Count() + lightSet2.Count();
shadowCount = shadowSet1.Count() + shadowSet2.Count();
}
// Create once, initialize
private void CreateGUI()
{
// Generate color-blind friendly colors
VisionUtility.GetColorBlindSafePalette(batchColors, 0.51f, 1.0f);
var visualTree = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(ResourcePath + "LightBatchingDebugger.uxml");
var templateRoot = visualTree.Instantiate();
templateRoot.style.flexGrow = 1;
templateRoot.Q("ParentElement").StretchToParentSize();
root.Add(templateRoot);
var batchElement = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(ResourcePath + "LayerBatch.uxml");
Func<VisualElement> makeItem = () => batchElement.Instantiate();
Action<VisualElement, int> bindItem = (e, i) =>
{
if (i >= batchList.Count())
return;
// This is required to make the child of the ListView vary in heights
e.style.height = StyleKeyword.Auto;
var batch = batchList[i];
var batchIndex = e.Query<Label>("BatchIndex").First();
batchIndex.text = batch.batchId.ToString();
var layers = e.Query<VisualElement>("LayerNames").First();
layers.Clear();
foreach (var layerName in batchList[i].LayerNames)
{
var label = new Label { text = layerName };
label.AddToClassList("LayerNameLabel");
layers.Add(label);
}
var color = e.Query<VisualElement>("BatchColor").First();
color.style.backgroundColor = new StyleColor(batchColors[i % batchColors.Length]);
};
DisplayInitialPrompt(true);
batchListView = root.Query<ListView>("BatchList").First();
batchListView.itemsSource = batchList;
batchListView.makeItem = makeItem;
batchListView.bindItem = bindItem;
batchListView.virtualizationMethod = CollectionVirtualizationMethod.DynamicHeight;
batchListView.showAlternatingRowBackgrounds = AlternatingRowBackground.ContentOnly;
batchListView.selectionType = SelectionType.Multiple;
batchListView.selectionChanged += objects =>
{
OnSelectionChanged();
};
}
private void OnEnable()
{
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
}
private void OnDisable()
{
EditorApplication.playModeStateChanged -= OnPlayModeStateChanged;
}
void OnPlayModeStateChanged(PlayModeStateChange playModeState)
{
if (PlayModeStateChange.EnteredEditMode == playModeState)
QueueRefresh();
}
void DisplayInitialPrompt(bool display)
{
var initialPrompt = root.Query<Label>("InitialPrompt").First();
initialPrompt.style.display = display ? DisplayStyle.Flex : DisplayStyle.None;
var infoView = root.Query<VisualElement>("InfoView").First();
infoView.style.display = display ? DisplayStyle.None : DisplayStyle.Flex;
}
private void OnSelectionChanged()
{
if (batchListView == null)
return;
switch (batchListView.selectedIndices.Count())
{
case 1:
selectedIndices.Clear();
selectedIndices.Add(batchListView.selectedIndex);
ViewBatch(batchListView.selectedIndex);
break;
case 2:
selectedIndices.Clear();
var firstIndex = batchListView.selectedIndices.First();
var secondIndex = batchListView.selectedIndices.Last();
if (secondIndex > firstIndex + 1 || secondIndex < firstIndex - 1)
{
// Clamp since we do adjacent batch comparisons
secondIndex = Mathf.Clamp(secondIndex, firstIndex - 1, firstIndex + 1);
selectedIndices.Add(firstIndex);
selectedIndices.Add(secondIndex);
batchListView.SetSelection(selectedIndices);
}
else
{
CompareBatch(firstIndex, secondIndex);
selectedIndices.AddRange(batchListView.selectedIndices);
}
break;
default:
// Account for multiple select either with shift or ctrl keys
if (batchListView.selectedIndices.Count() > 2)
{
if (selectedIndices.Count == 1)
{
firstIndex = secondIndex = selectedIndices.First();
if (batchListView.selectedIndices.First() > firstIndex)
secondIndex = firstIndex + 1;
else if (batchListView.selectedIndices.First() < firstIndex)
secondIndex = firstIndex - 1;
selectedIndices.Add(secondIndex);
batchListView.SetSelection(selectedIndices);
}
else if (selectedIndices.Count == 2)
{
batchListView.SetSelection(selectedIndices);
}
}
break;
}
// Update counts
Label lightHeader = root.Query<Label>("LightHeader");
lightHeader.text = $"Lights ({lightCount})";
Label shadowHeader = root.Query<Label>("ShadowHeader");
shadowHeader.text = $"Shadow Casters ({shadowCount})";
}
private void RefreshView()
{
PopulateData();
batchListView.RefreshItems();
OnSelectionChanged();
ResetDirty();
}
private void Update()
{
if (IsDirty())
QueueRefresh();
if (doRefresh)
RefreshView();
}
private bool IsDirty()
{
if (lightCullResult == null)
return false;
bool isDirty = false;
// Refresh if layers are added or removed
isDirty |= Light2DManager.GetCachedSortingLayer().Count() != batchList.Sum(x => x.LayerNames.Count());
isDirty |= cachedSceneHandle != SceneManager.GetActiveScene().handle;
isDirty |= cachedCamPos != Camera.main?.transform.position;
if (lightCullResult.IsGameView())
{
isDirty |= totalLightCount != lightCullResult.visibleLights.Count();
isDirty |= totalShadowCount != lightCullResult.visibleShadows.Count();
}
return isDirty;
}
private void ResetDirty()
{
cachedSceneHandle = SceneManager.GetActiveScene().handle;
if (Camera.main != null)
cachedCamPos = Camera.main.transform.position;
if (lightCullResult != null)
{
totalLightCount = lightCullResult.visibleLights.Count();
totalShadowCount = lightCullResult.visibleShadows.Count();
}
doRefresh = false;
}
public void QueueRefresh()
{
doRefresh = true;
}
}
}

View File

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

View File

@@ -0,0 +1,138 @@
:root {
--border-color-custom: rgb(161, 154, 154);
}
.BatchList {
}
.BatchList.HeaderContainer {
flex-direction: row;
height: auto;
background-color: var(--unity-colors-inspector_titlebar-background);
}
.BatchList.IndexColumn {
margin-left: 5px;
width: 65px;
}
.BatchList.ColorColumn {
width: 3px;
}
.BatchList.NameColumn {
flex-grow: 2;
margin-left: 5px;
}
.BatchList.BatchContainer {
flex-direction: row;
}
.BatchList.ColorColumn.Container {
align-items: center;
}
.BatchList.ColorColumn.Splitter {
margin-top: 5px;
margin-bottom: 5px;
margin-right: 5px;
}
.BatchList.IndexColumn.Header {
margin-top: 5px;
margin-bottom: 5px;
}
.BatchList.NameColumn.Header {
margin-top: 5px;
margin-bottom: 5px;
}
.BatchList.IndexColumn.Batch {
margin-top: 5px;
}
.BatchList.NameColumn.Batch {
margin-top: 5px;
flex-direction: column;
}
.BatchList.List {
flex-grow: 1;
}
.LayerNameLabel {
margin-bottom: 5px;
}
.InfoView {
}
.InfoView.Content {
border-bottom-width: 10px;
white-space: normal;
}
.InfoView.Content.PillContainer {
flex-direction: row;
flex-wrap: wrap;
}
.InfoView.Content.Spacer {
flex-grow: 1;
}
.InfoView.Footer {
padding: 10px;
white-space: normal;
}
.InfoView.Header {
padding: 5px;
align-items: flex-start;
justify-content: space-around;
background-color: var(--unity-colors-window-background);
}
.InfoView.Header.Bottom {
border-bottom-color: var(--unity-colors-default-border);
}
.InfoView.Header.Top {
border-top-color: var(--unity-colors-default-border);
}
.InfoScroller {
flex-grow: 1;
padding: 10px;
}
.MinSize {
min-width: 160px;
min-height: 160px;
}
.InfoContainer{
min-width: 160px;
flex-grow: 1;
background-color: var(--unity-colors-default-background);
justify-content: center;
}
.InitialPrompt {
align-self: center;
}
.Pill {
border-color: var(--border-color-custom);
border-left-width: 1px;
border-right-width: 1px;
border-top-width: 1px;
border-bottom-width: 1px;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fd5cb3dd3de574f1585db92b6689f86a
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0

View File

@@ -0,0 +1,57 @@
<UXML xmlns="UnityEngine.UIElements">
<VisualElement name="ParentElement" style="flex-direction:column">
<Style src="LightBatchingDebugger.uss" />
<Box class="InfoView Header Bottom">
<Label name="InfoTitle"/>
</Box>
<TwoPaneSplitView fixed-pane-initial-dimension="200">
<!--Left Split View Layer Batch Info-->
<VisualElement class="MinSize">
<Box class="BatchList HeaderContainer">
<Label class="BatchList IndexColumn Header" text="Batch ID"/>
<VisualElement class="BatchList ColorColumn Container">
<Label text="|" class="BatchList ColorColumn Splitter"/>
</VisualElement>
<Label class="BatchList NameColumn Header" text="Layer Names"/>
</Box>
<ListView name="BatchList" class="BatchList List"/>
</VisualElement>
<!--Right Split View Lights and Shadows-->
<VisualElement name="InfoContainer" class="InfoContainer">
<Label name="InitialPrompt" text="Open Game View and select a batch to begin." class="InitialPrompt"/>
<TwoPaneSplitView name="InfoView" fixed-pane-initial-dimension="500" orientation="Vertical">
<!--Light Split View Top-->
<VisualElement class="MinSize">
<Box class="BatchList HeaderContainer">
<Label name="LightHeader" class="BatchList IndexColumn Header"/>
</Box>
<ScrollView class="InfoScroller">
<Label name="LightLabel1" class="InfoView Content"/>
<VisualElement name="LightBubble1" class="InfoView Content PillContainer"/>
<Label name="LightLabel2" class="InfoView Content"/>
<VisualElement name="LightBubble2" class="InfoView Content PillContainer"/>
</ScrollView>
</VisualElement>
<!--Shadow Caster Split View Bottom-->
<VisualElement class="MinSize">
<Box class="BatchList HeaderContainer">
<Label name="ShadowHeader" class="BatchList IndexColumn Header"/>
</Box>
<ScrollView class="InfoScroller">
<Label name="ShadowLabel1" class="InfoView Content"/>
<VisualElement name="ShadowBubble1" class="InfoView Content PillContainer"/>
<Label name="ShadowLabel2" class="InfoView Content"/>
<VisualElement name="ShadowBubble2" class="InfoView Content PillContainer"/>
</ScrollView>
</VisualElement>
</TwoPaneSplitView>
</VisualElement>
</TwoPaneSplitView>
<Box class="InfoView Header Top">
<Label name="InfoTitle2"/>
</Box>
</VisualElement>
</UXML>

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 7f54b2764826949c192810bd3944abcc
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}

View File

@@ -0,0 +1,277 @@
using System;
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
[CustomEditor(typeof(PixelPerfectCamera))]
class PixelPerfectCameraEditor : Editor
{
private class Style
{
public GUIContent x = new GUIContent("X");
public GUIContent y = new GUIContent("Y");
public GUIContent assetsPPU = new GUIContent("Assets Pixels Per Unit", "The amount of pixels that make up one unit of the Scene. Set this value to match the PPU value of Sprites in the Scene.");
public GUIContent refRes = new GUIContent("Reference Resolution", "The original resolution the Assets are designed for.");
public GUIContent gridSnapping = new GUIContent("Grid Snapping", "Sets the snapping behavior for the camera and sprites.");
public GUIContent cropFrame = new GUIContent("Crop Frame", "Crops the viewport to match the Reference Resolution, along the checked axis. Black bars will be added to fit the screen aspect ratio.");
public GUIContent filterMode = new GUIContent("Filter Mode", "Use selected Filter Mode when using Stretch Fill to upscale from Reference Resolution.");
public GUIContent stretchFill = new GUIContent("Stretch Fill", "If enabled, expands the viewport to fit the screen resolution while maintaining the viewport aspect ratio.");
public GUIContent currentPixelRatio = new GUIContent("Current Pixel Ratio", "Ratio of the rendered Sprites compared to their original size.");
public GUIContent runInEditMode = new GUIContent("Run In Edit Mode", "Enable this to preview Camera setting changes in Edit Mode. This will cause constant changes to the Scene while active.");
public const string cameraStackingWarning = "Pixel Perfect Camera won't function properly if stacked with another camera.";
public const string nonRenderer2DWarning = "URP Pixel Perfect Camera requires a camera using a 2D Renderer. Some features, such as Upscale Render Texture, are not supported with other Renderers.";
public const string nonRenderer2DError = "URP Pixel Perfect Camera requires a camera using a 2D Renderer.";
public GUIStyle centeredLabel;
public Style()
{
centeredLabel = new GUIStyle(EditorStyles.label);
centeredLabel.alignment = TextAnchor.MiddleCenter;
}
}
private static Style m_Style;
private const float k_SingleLetterLabelWidth = 15.0f;
private const float k_DottedLineSpacing = 2.5f;
private SerializedProperty m_AssetsPPU;
private SerializedProperty m_RefResX;
private SerializedProperty m_RefResY;
private SerializedProperty m_CropFrame;
private SerializedProperty m_FilterMode;
private SerializedProperty m_GridSnapping;
private Vector2 m_GameViewSize = Vector2.zero;
private GUIContent m_CurrentPixelRatioValue;
bool m_CameraStacking;
private void LazyInit()
{
if (m_Style == null)
m_Style = new Style();
if (m_CurrentPixelRatioValue == null)
m_CurrentPixelRatioValue = new GUIContent();
}
UniversalAdditionalCameraData GetCameraData()
{
PixelPerfectCamera obj = target as PixelPerfectCamera;
UniversalAdditionalCameraData cameraData = null;
obj?.TryGetComponent(out cameraData);
return cameraData;
}
bool UsingSRP()
{
var cameraData = GetCameraData();
return cameraData?.scriptableRenderer != null;
}
bool UsingRenderer2D()
{
var cameraData = GetCameraData();
if (cameraData != null)
{
Renderer2D renderer2D = cameraData.scriptableRenderer as Renderer2D;
if (renderer2D != null)
return true;
}
return false;
}
void CheckForCameraStacking()
{
m_CameraStacking = false;
var cameraData = GetCameraData();
if (cameraData == null || cameraData.scriptableRenderer == null)
return;
if (cameraData.renderType == CameraRenderType.Base)
{
var cameraStack = cameraData.cameraStack;
m_CameraStacking = cameraStack != null ? cameraStack.Count > 0 : false;
}
else if (cameraData.renderType == CameraRenderType.Overlay)
m_CameraStacking = true;
}
public void OnEnable()
{
m_AssetsPPU = serializedObject.FindProperty("m_AssetsPPU");
m_RefResX = serializedObject.FindProperty("m_RefResolutionX");
m_RefResY = serializedObject.FindProperty("m_RefResolutionY");
m_CropFrame = serializedObject.FindProperty("m_CropFrame");
m_FilterMode = serializedObject.FindProperty("m_FilterMode");
m_GridSnapping = serializedObject.FindProperty("m_GridSnapping");
}
public override bool RequiresConstantRepaint()
{
PixelPerfectCamera obj = target as PixelPerfectCamera;
if (obj == null || !obj.enabled)
return false;
// If game view size changes, we need to force a repaint of the inspector as the pixel ratio value may change accordingly.
Vector2 gameViewSize = Handles.GetMainGameViewSize();
if (gameViewSize != m_GameViewSize)
{
m_GameViewSize = gameViewSize;
return true;
}
else
return false;
}
public override void OnInspectorGUI()
{
LazyInit();
if (!UsingSRP())
{
EditorGUILayout.HelpBox(Style.nonRenderer2DError, MessageType.Error);
return;
}
else if (!UsingRenderer2D())
{
EditorGUILayout.HelpBox(Style.nonRenderer2DWarning, MessageType.Warning);
EditorGUILayout.Space();
}
float originalLabelWidth = EditorGUIUtility.labelWidth;
serializedObject.Update();
if (Event.current.type == EventType.Layout)
CheckForCameraStacking();
if (m_CameraStacking)
EditorGUILayout.HelpBox(Style.cameraStackingWarning, MessageType.Warning);
EditorGUILayout.PropertyField(m_AssetsPPU, m_Style.assetsPPU);
if (m_AssetsPPU.intValue <= 0)
m_AssetsPPU.intValue = 1;
EditorGUILayout.BeginHorizontal();
{
EditorGUILayout.PrefixLabel(m_Style.refRes);
EditorGUIUtility.labelWidth = k_SingleLetterLabelWidth * (EditorGUI.indentLevel + 1);
EditorGUILayout.PropertyField(m_RefResX, m_Style.x);
if (m_RefResX.intValue <= 0)
m_RefResX.intValue = 1;
EditorGUILayout.PropertyField(m_RefResY, m_Style.y);
if (m_RefResY.intValue <= 0)
m_RefResY.intValue = 1;
EditorGUIUtility.labelWidth = originalLabelWidth;
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.PropertyField(m_CropFrame, m_Style.cropFrame);
EditorGUILayout.PropertyField(m_GridSnapping, m_Style.gridSnapping);
if (m_CropFrame.enumValueIndex == (int)PixelPerfectCamera.CropFrame.StretchFill)
{
EditorGUILayout.PropertyField(m_FilterMode, m_Style.filterMode);
}
serializedObject.ApplyModifiedProperties();
PixelPerfectCamera obj = target as PixelPerfectCamera;
if (obj != null)
{
if (obj.isActiveAndEnabled && (EditorApplication.isPlaying || obj.runInEditMode))
{
if (Event.current.type == EventType.Layout)
m_CurrentPixelRatioValue.text = string.Format("{0}:1", obj.pixelRatio);
EditorGUI.BeginDisabledGroup(true);
EditorGUILayout.LabelField(m_Style.currentPixelRatio, m_CurrentPixelRatioValue);
EditorGUI.EndDisabledGroup();
}
}
}
void OnSceneGUI()
{
PixelPerfectCamera obj = target as PixelPerfectCamera;
if (obj == null)
return;
Camera camera = obj.GetComponent<Camera>();
// Show a green rect in scene view that represents the visible area when the pixel perfect correction takes effect in play mode.
Vector2 gameViewSize = Handles.GetMainGameViewSize();
int gameViewWidth = (int)gameViewSize.x;
int gameViewHeight = (int)gameViewSize.y;
int zoom = Math.Max(1, Math.Min(gameViewHeight / obj.refResolutionY, gameViewWidth / obj.refResolutionX));
float verticalOrthoSize;
float horizontalOrthoSize;
if (obj.cropFrame == PixelPerfectCamera.CropFrame.StretchFill || obj.cropFrame == PixelPerfectCamera.CropFrame.Windowbox)
{
verticalOrthoSize = obj.refResolutionY * 0.5f / obj.assetsPPU;
horizontalOrthoSize = verticalOrthoSize * ((float)obj.refResolutionX / obj.refResolutionY);
}
else if (obj.cropFrame == PixelPerfectCamera.CropFrame.Letterbox)
{
verticalOrthoSize = obj.refResolutionY * 0.5f / obj.assetsPPU;
horizontalOrthoSize = verticalOrthoSize * ((float)gameViewWidth / (zoom * obj.refResolutionY));
}
else if (obj.cropFrame == PixelPerfectCamera.CropFrame.Pillarbox)
{
horizontalOrthoSize = obj.refResolutionX * 0.5f / obj.assetsPPU;
verticalOrthoSize = horizontalOrthoSize / (zoom * obj.refResolutionX / (float)gameViewHeight);
}
else
{
verticalOrthoSize = gameViewHeight * 0.5f / (zoom * obj.assetsPPU);
horizontalOrthoSize = verticalOrthoSize * camera.aspect;
}
Handles.color = Color.green;
Vector3 cameraPosition = camera.transform.position;
Vector3 p1 = cameraPosition + new Vector3(-horizontalOrthoSize, verticalOrthoSize, 0.0f);
Vector3 p2 = cameraPosition + new Vector3(horizontalOrthoSize, verticalOrthoSize, 0.0f);
Handles.DrawLine(p1, p2);
p1 = cameraPosition + new Vector3(horizontalOrthoSize, -verticalOrthoSize, 0.0f);
Handles.DrawLine(p2, p1);
p2 = cameraPosition + new Vector3(-horizontalOrthoSize, -verticalOrthoSize, 0.0f);
Handles.DrawLine(p1, p2);
p1 = cameraPosition + new Vector3(-horizontalOrthoSize, verticalOrthoSize, 0.0f);
Handles.DrawLine(p2, p1);
// Show a green dotted rect in scene view that represents the area defined by the reference resolution.
horizontalOrthoSize = obj.refResolutionX * 0.5f / obj.assetsPPU;
verticalOrthoSize = obj.refResolutionY * 0.5f / obj.assetsPPU;
p1 = cameraPosition + new Vector3(-horizontalOrthoSize, verticalOrthoSize, 0.0f);
p2 = cameraPosition + new Vector3(horizontalOrthoSize, verticalOrthoSize, 0.0f);
Handles.DrawDottedLine(p1, p2, k_DottedLineSpacing);
p1 = cameraPosition + new Vector3(horizontalOrthoSize, -verticalOrthoSize, 0.0f);
Handles.DrawDottedLine(p2, p1, k_DottedLineSpacing);
p2 = cameraPosition + new Vector3(-horizontalOrthoSize, -verticalOrthoSize, 0.0f);
Handles.DrawDottedLine(p1, p2, k_DottedLineSpacing);
p1 = cameraPosition + new Vector3(-horizontalOrthoSize, verticalOrthoSize, 0.0f);
Handles.DrawDottedLine(p2, p1, k_DottedLineSpacing);
}
}
}

View File

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

View File

@@ -0,0 +1,112 @@
using System;
using UnityEngine;
using UnityEngine.Analytics;
using UnityEngine.Rendering.Universal;
using static UnityEngine.Analytics.IAnalytic;
namespace UnityEditor.Rendering.Universal.Analytics
{
struct AnalyticsDataTypes
{
public const string k_LightDataString = "u2drendererlights";
public const string k_Renderer2DDataString = "u2drendererdata";
public const int k_MaxEventsPerHour = 1000;
public const int k_MaxNumberOfElements = 1000;
public const string k_VendorKey = "unity.renderpipelines.universal.editor";
public const int k_Version = 1;
}
[AnalyticInfo(eventName: AnalyticsDataTypes.k_LightDataString, vendorKey: AnalyticsDataTypes.k_VendorKey, maxEventsPerHour: AnalyticsDataTypes.k_MaxEventsPerHour, maxNumberOfElements: AnalyticsDataTypes.k_MaxNumberOfElements)]
internal class LightDataAnalytic : IAnalytic
{
public LightDataAnalytic(int instance_id, bool was_create_event, Light2D.LightType light_type)
{
m_Data = new Light2DData
{
instance_id = instance_id,
was_create_event = was_create_event,
light_type = light_type
};
}
[Serializable]
internal struct Light2DData : IAnalytic.IData
{
[SerializeField]
public bool was_create_event;
[SerializeField]
public int instance_id;
[SerializeField]
public Light2D.LightType light_type;
};
public bool TryGatherData(out IAnalytic.IData data, out Exception error)
{
data = m_Data;
error = null;
return true;
}
Light2DData m_Data;
}
[AnalyticInfo(eventName: AnalyticsDataTypes.k_Renderer2DDataString, vendorKey: AnalyticsDataTypes.k_VendorKey, maxEventsPerHour: AnalyticsDataTypes.k_MaxEventsPerHour, maxNumberOfElements: AnalyticsDataTypes.k_MaxNumberOfElements)]
internal class RenderAssetAnalytic : IAnalytic
{
public RenderAssetAnalytic(int instance_id, bool was_create_event, int blending_layers_count, int blending_modes_used)
{
m_Data = new RendererAssetData
{
instance_id = instance_id,
was_create_event = was_create_event,
blending_layers_count = blending_layers_count,
blending_modes_used = blending_modes_used
};
}
[Serializable]
internal struct RendererAssetData : IAnalytic.IData
{
[SerializeField]
public bool was_create_event;
[SerializeField]
public int instance_id;
[SerializeField]
public int blending_layers_count;
[SerializeField]
public int blending_modes_used;
}
public bool TryGatherData(out IAnalytic.IData data, out Exception error)
{
data = m_Data;
error = null;
return true;
}
RendererAssetData m_Data;
}
interface IAnalytics
{
AnalyticsResult SendData(IAnalytic analytic);
}
[InitializeOnLoad]
internal class Renderer2DAnalytics : IAnalytics
{
static Renderer2DAnalytics m_Instance = new Renderer2DAnalytics();
public static Renderer2DAnalytics instance
{
get
{
if (m_Instance == null)
m_Instance = new Renderer2DAnalytics();
return m_Instance;
}
}
public AnalyticsResult SendData(IAnalytic analytic)
{
return EditorAnalytics.SendAnalytic(analytic);
}
}
}

View File

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

View File

@@ -0,0 +1,291 @@
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace UnityEditor.Rendering.Universal
{
[CustomEditor(typeof(Renderer2DData), true)]
internal class Renderer2DDataEditor : ScriptableRendererDataEditor
{
class Styles
{
public static readonly GUIContent generalHeader = EditorGUIUtility.TrTextContent("General");
public static readonly GUIContent lightRenderTexturesHeader = EditorGUIUtility.TrTextContent("Light Render Textures");
public static readonly GUIContent lightBlendStylesHeader = EditorGUIUtility.TrTextContent("Light Blend Styles", "A Light Blend Style is a collection of properties that describe a particular way of applying lighting.");
public static readonly GUIContent postProcessHeader = EditorGUIUtility.TrTextContent("Post-processing");
public static readonly GUIContent filteringSectionLabel = EditorGUIUtility.TrTextContent("Filtering", "Settings that controls and define which layers the renderer draws.");
public static readonly GUIContent layerMask = EditorGUIUtility.TrTextContent("Layer Mask", "Controls which transparent layers this renderer draws.");
public static readonly GUIContent transparencySortMode = EditorGUIUtility.TrTextContent("Transparency Sort Mode", "Default sorting mode used for transparent objects");
public static readonly GUIContent transparencySortAxis = EditorGUIUtility.TrTextContent("Transparency Sort Axis", "Axis used for custom axis sorting mode");
public static readonly GUIContent hdrEmulationScale = EditorGUIUtility.TrTextContent("HDR Emulation Scale", "Describes the scaling used by lighting to remap dynamic range between LDR and HDR");
public static readonly GUIContent lightRTScale = EditorGUIUtility.TrTextContent("Render Scale", "The resolution of intermediate light render textures, in relation to the screen resolution. 1.0 means full-screen size.");
public static readonly GUIContent maxLightRTCount = EditorGUIUtility.TrTextContent("Max Light Render Textures", "How many intermediate light render textures can be created and utilized concurrently. Higher value usually leads to better performance on mobile hardware at the cost of more memory.");
public static readonly GUIContent maxShadowRTCount = EditorGUIUtility.TrTextContent("Max Shadow Render Textures", "How many intermediate shadow render textures can be created and utilized concurrently. Higher value usually leads to better performance on mobile hardware at the cost of more memory.");
public static readonly GUIContent defaultMaterialType = EditorGUIUtility.TrTextContent("Default Material Type", "Material to use when adding new objects to a scene");
public static readonly GUIContent defaultCustomMaterial = EditorGUIUtility.TrTextContent("Default Custom Material", "Material to use when adding new objects to a scene");
public static readonly GUIContent name = EditorGUIUtility.TrTextContent("Name");
public static readonly GUIContent maskTextureChannel = EditorGUIUtility.TrTextContent("Mask Texture Channel", "Which channel of the mask texture will affect this Light Blend Style.");
public static readonly GUIContent blendMode = EditorGUIUtility.TrTextContent("Blend Mode", "How the lighting should be blended with the main color of the objects.");
public static readonly GUIContent useDepthStencilBuffer = EditorGUIUtility.TrTextContent("Depth/Stencil Buffer", "Uncheck this when you are certain you don't use any feature that requires the depth/stencil buffer (e.g. Sprite Mask). Not using the depth/stencil buffer may improve performance, especially on mobile platforms.");
public static readonly GUIContent postProcessIncluded = EditorGUIUtility.TrTextContent("Enabled", "Turns post-processing on (check box selected) or off (check box cleared). If you clear this check box, Unity excludes post-processing render Passes, shaders, and textures from the build.");
public static readonly GUIContent postProcessData = EditorGUIUtility.TrTextContent("Data", "The asset containing references to shaders and Textures that the Renderer uses for post-processing.");
public static readonly GUIContent cameraSortingLayerTextureHeader = EditorGUIUtility.TrTextContent("Camera Sorting Layer Texture", "Layers from back most to selected bounds will be rendered to _CameraSortingLayerTexture");
public static readonly GUIContent cameraSortingLayerTextureBound = EditorGUIUtility.TrTextContent("Foremost Sorting Layer", "Layers from back most to selected bounds will be rendered to _CameraSortingLayerTexture");
public static readonly GUIContent cameraSortingLayerDownsampling = EditorGUIUtility.TrTextContent("Downsampling Method", "Method used to copy _CameraSortingLayerTexture");
}
struct LightBlendStyleProps
{
public SerializedProperty name;
public SerializedProperty maskTextureChannel;
public SerializedProperty blendMode;
public SerializedProperty blendFactorMultiplicative;
public SerializedProperty blendFactorAdditive;
}
SerializedProperty m_LayerMask;
SerializedProperty m_TransparencySortMode;
SerializedProperty m_TransparencySortAxis;
SerializedProperty m_HDREmulationScale;
SerializedProperty m_LightRenderTextureScale;
SerializedProperty m_LightBlendStyles;
LightBlendStyleProps[] m_LightBlendStylePropsArray;
SerializedProperty m_UseDepthStencilBuffer;
SerializedProperty m_DefaultMaterialType;
SerializedProperty m_DefaultCustomMaterial;
SerializedProperty m_MaxLightRenderTextureCount;
SerializedProperty m_MaxShadowRenderTextureCount;
SerializedProperty m_PostProcessData;
SerializedProperty m_UseCameraSortingLayersTexture;
SerializedProperty m_CameraSortingLayersTextureBound;
SerializedProperty m_CameraSortingLayerDownsamplingMethod;
SavedBool m_FilteringFoldout;
SavedBool m_GeneralFoldout;
SavedBool m_LightRenderTexturesFoldout;
SavedBool m_LightBlendStylesFoldout;
SavedBool m_CameraSortingLayerTextureFoldout;
SavedBool m_PostProcessingFoldout;
Analytics.Renderer2DAnalytics m_Analytics = Analytics.Renderer2DAnalytics.instance;
Renderer2DData m_Renderer2DData;
bool m_WasModified;
void SendModifiedAnalytics(Analytics.IAnalytics analytics)
{
if (m_WasModified)
{
Analytics.RenderAssetAnalytic modifiedData = new Analytics.RenderAssetAnalytic(m_Renderer2DData.GetInstanceID(), false, 0, 0);
analytics.SendData(modifiedData);
}
}
void OnEnable()
{
m_WasModified = false;
m_Renderer2DData = (Renderer2DData)serializedObject.targetObject;
m_LayerMask = serializedObject.FindProperty("m_LayerMask");
m_TransparencySortMode = serializedObject.FindProperty("m_TransparencySortMode");
m_TransparencySortAxis = serializedObject.FindProperty("m_TransparencySortAxis");
m_HDREmulationScale = serializedObject.FindProperty("m_HDREmulationScale");
m_LightRenderTextureScale = serializedObject.FindProperty("m_LightRenderTextureScale");
m_LightBlendStyles = serializedObject.FindProperty("m_LightBlendStyles");
m_MaxLightRenderTextureCount = serializedObject.FindProperty("m_MaxLightRenderTextureCount");
m_MaxShadowRenderTextureCount = serializedObject.FindProperty("m_MaxShadowRenderTextureCount");
m_PostProcessData = serializedObject.FindProperty("m_PostProcessData");
m_CameraSortingLayersTextureBound = serializedObject.FindProperty("m_CameraSortingLayersTextureBound");
m_UseCameraSortingLayersTexture = serializedObject.FindProperty("m_UseCameraSortingLayersTexture");
m_CameraSortingLayerDownsamplingMethod = serializedObject.FindProperty("m_CameraSortingLayerDownsamplingMethod");
int numBlendStyles = m_LightBlendStyles.arraySize;
m_LightBlendStylePropsArray = new LightBlendStyleProps[numBlendStyles];
for (int i = 0; i < numBlendStyles; ++i)
{
SerializedProperty blendStyleProp = m_LightBlendStyles.GetArrayElementAtIndex(i);
ref LightBlendStyleProps props = ref m_LightBlendStylePropsArray[i];
props.name = blendStyleProp.FindPropertyRelative("name");
props.maskTextureChannel = blendStyleProp.FindPropertyRelative("maskTextureChannel");
props.blendMode = blendStyleProp.FindPropertyRelative("blendMode");
props.blendFactorMultiplicative = blendStyleProp.FindPropertyRelative("customBlendFactors.multiplicative");
props.blendFactorAdditive = blendStyleProp.FindPropertyRelative("customBlendFactors.additive");
if (props.blendFactorMultiplicative == null)
props.blendFactorMultiplicative = blendStyleProp.FindPropertyRelative("customBlendFactors.modulate");
if (props.blendFactorAdditive == null)
props.blendFactorAdditive = blendStyleProp.FindPropertyRelative("customBlendFactors.additve");
}
m_UseDepthStencilBuffer = serializedObject.FindProperty("m_UseDepthStencilBuffer");
m_DefaultMaterialType = serializedObject.FindProperty("m_DefaultMaterialType");
m_DefaultCustomMaterial = serializedObject.FindProperty("m_DefaultCustomMaterial");
m_FilteringFoldout = new SavedBool($"{target.GetType()}.FilteringFoldout", true);
m_GeneralFoldout = new SavedBool($"{target.GetType()}.GeneralFoldout", true);
m_LightRenderTexturesFoldout = new SavedBool($"{target.GetType()}.LightRenderTexturesFoldout", true);
m_LightBlendStylesFoldout = new SavedBool($"{target.GetType()}.LightBlendStylesFoldout", true);
m_CameraSortingLayerTextureFoldout = new SavedBool($"{target.GetType()}.CameraSortingLayerTextureFoldout", true);
m_PostProcessingFoldout = new SavedBool($"{target.GetType()}.PostProcessingFoldout", true);
}
private void OnDestroy()
{
SendModifiedAnalytics(m_Analytics);
}
public override void OnInspectorGUI()
{
serializedObject.Update();
DrawFiltering();
DrawGeneral();
DrawLightRenderTextures();
DrawLightBlendStyles();
DrawCameraSortingLayerTexture();
DrawPostProcessing();
m_WasModified |= serializedObject.hasModifiedProperties;
serializedObject.ApplyModifiedProperties();
EditorGUILayout.Space();
base.OnInspectorGUI(); // Draw the base UI, contains ScriptableRenderFeatures list
}
public void DrawCameraSortingLayerTexture()
{
CoreEditorUtils.DrawSplitter();
m_CameraSortingLayerTextureFoldout.value = CoreEditorUtils.DrawHeaderFoldout(Styles.cameraSortingLayerTextureHeader, m_CameraSortingLayerTextureFoldout.value);
if (!m_CameraSortingLayerTextureFoldout.value)
return;
SortingLayer[] sortingLayers = SortingLayer.layers;
string[] optionNames = new string[sortingLayers.Length + 1];
int[] optionIds = new int[sortingLayers.Length + 1];
optionNames[0] = "Disabled";
optionIds[0] = -1;
int currentOptionIndex = 0;
for (int i = 0; i < sortingLayers.Length; i++)
{
optionNames[i + 1] = sortingLayers[i].name;
optionIds[i + 1] = sortingLayers[i].id;
if (sortingLayers[i].id == m_CameraSortingLayersTextureBound.intValue)
currentOptionIndex = i + 1;
}
int selectedOptionIndex = !m_UseCameraSortingLayersTexture.boolValue ? 0 : currentOptionIndex;
selectedOptionIndex = EditorGUILayout.Popup(Styles.cameraSortingLayerTextureBound, selectedOptionIndex, optionNames);
m_UseCameraSortingLayersTexture.boolValue = selectedOptionIndex != 0;
m_CameraSortingLayersTextureBound.intValue = optionIds[selectedOptionIndex];
EditorGUI.BeginDisabledGroup(!m_UseCameraSortingLayersTexture.boolValue);
EditorGUILayout.PropertyField(m_CameraSortingLayerDownsamplingMethod, Styles.cameraSortingLayerDownsampling);
EditorGUI.EndDisabledGroup();
}
private void DrawFiltering()
{
CoreEditorUtils.DrawSplitter();
m_FilteringFoldout.value = CoreEditorUtils.DrawHeaderFoldout(Styles.filteringSectionLabel, m_FilteringFoldout.value);
if (!m_FilteringFoldout.value)
return;
EditorGUILayout.PropertyField(m_LayerMask, Styles.layerMask);
EditorGUILayout.Space();
}
private void DrawGeneral()
{
CoreEditorUtils.DrawSplitter();
m_GeneralFoldout.value = CoreEditorUtils.DrawHeaderFoldout(Styles.generalHeader, m_GeneralFoldout.value);
if (!m_GeneralFoldout.value)
return;
EditorGUILayout.PropertyField(m_TransparencySortMode, Styles.transparencySortMode);
using (new EditorGUI.DisabledGroupScope(m_TransparencySortMode.intValue != (int)TransparencySortMode.CustomAxis))
EditorGUILayout.PropertyField(m_TransparencySortAxis, Styles.transparencySortAxis);
EditorGUILayout.PropertyField(m_DefaultMaterialType, Styles.defaultMaterialType);
if (m_DefaultMaterialType.intValue == (int)Renderer2DData.Renderer2DDefaultMaterialType.Custom)
EditorGUILayout.PropertyField(m_DefaultCustomMaterial, Styles.defaultCustomMaterial);
EditorGUILayout.PropertyField(m_UseDepthStencilBuffer, Styles.useDepthStencilBuffer);
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(m_HDREmulationScale, Styles.hdrEmulationScale);
if (EditorGUI.EndChangeCheck() && m_HDREmulationScale.floatValue < 1.0f)
m_HDREmulationScale.floatValue = 1.0f;
EditorGUILayout.Space();
}
private void DrawLightRenderTextures()
{
CoreEditorUtils.DrawSplitter();
m_LightRenderTexturesFoldout.value = CoreEditorUtils.DrawHeaderFoldout(Styles.lightRenderTexturesHeader, m_LightRenderTexturesFoldout.value);
if (!m_LightRenderTexturesFoldout.value)
return;
EditorGUILayout.PropertyField(m_LightRenderTextureScale, Styles.lightRTScale);
EditorGUILayout.PropertyField(m_MaxLightRenderTextureCount, Styles.maxLightRTCount);
EditorGUILayout.PropertyField(m_MaxShadowRenderTextureCount, Styles.maxShadowRTCount);
EditorGUILayout.Space();
}
private void DrawLightBlendStyles()
{
CoreEditorUtils.DrawSplitter();
m_LightBlendStylesFoldout.value = CoreEditorUtils.DrawHeaderFoldout(Styles.lightBlendStylesHeader, m_LightBlendStylesFoldout.value);
if (!m_LightBlendStylesFoldout.value)
return;
int numBlendStyles = m_LightBlendStyles.arraySize;
for (int i = 0; i < numBlendStyles; ++i)
{
ref LightBlendStyleProps props = ref m_LightBlendStylePropsArray[i];
EditorGUILayout.PropertyField(props.name, Styles.name);
EditorGUILayout.PropertyField(props.maskTextureChannel, Styles.maskTextureChannel);
EditorGUILayout.PropertyField(props.blendMode, Styles.blendMode);
EditorGUILayout.Space();
EditorGUILayout.Space();
}
EditorGUILayout.Space();
}
private void DrawPostProcessing()
{
CoreEditorUtils.DrawSplitter();
m_PostProcessingFoldout.value = CoreEditorUtils.DrawHeaderFoldout(Styles.postProcessHeader, m_PostProcessingFoldout.value);
if (!m_PostProcessingFoldout.value)
return;
EditorGUI.BeginChangeCheck();
var postProcessIncluded = EditorGUILayout.Toggle(Styles.postProcessIncluded, m_PostProcessData.objectReferenceValue != null);
if (EditorGUI.EndChangeCheck())
{
m_PostProcessData.objectReferenceValue = postProcessIncluded ? UnityEngine.Rendering.Universal.PostProcessData.GetDefaultPostProcessData() : null;
}
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_PostProcessData, Styles.postProcessData);
EditorGUI.indentLevel--;
EditorGUILayout.Space();
}
}
}

View File

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

View File

@@ -0,0 +1,216 @@
using System;
using UnityEditor.ProjectWindowCallback;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.Rendering.Universal;
using UnityEngine.Rendering;
using System.IO;
using UnityEngine.Analytics;
namespace UnityEditor.Rendering.Universal
{
static class Renderer2DMenus
{
static void Create2DRendererData(Action<Renderer2DData> onCreatedCallback)
{
var instance = ScriptableObject.CreateInstance<Create2DRendererDataAsset>();
instance.onCreated += onCreatedCallback;
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, instance, "New 2D Renderer Data.asset", null, null);
}
class Create2DRendererDataAsset : EndNameEditAction
{
public event Action<Renderer2DData> onCreated;
public override void Action(int instanceId, string pathName, string resourceFile)
{
var instance = CreateRendererAsset(pathName, RendererType._2DRenderer, false) as Renderer2DData;
Selection.activeObject = instance;
onCreated?.Invoke(instance);
}
}
static ScriptableRendererData CreateRendererAsset(string path, RendererType type, bool relativePath = true, string suffix = "Renderer")
{
string packagePath = "Packages/com.unity.render-pipelines.universal";
ScriptableRendererData data = CreateRendererData(type);
string dataPath;
if (relativePath)
dataPath =
$"{Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path))}_{suffix}{Path.GetExtension(path)}";
else
dataPath = path;
AssetDatabase.CreateAsset(data, dataPath);
ResourceReloader.ReloadAllNullIn(data, packagePath);
return data;
}
static ScriptableRendererData CreateRendererData(RendererType type)
{
var rendererData = ScriptableObject.CreateInstance<Renderer2DData>();
rendererData.postProcessData = PostProcessData.GetDefaultPostProcessData();
return rendererData;
}
internal static void PlaceGameObjectInFrontOfSceneView(GameObject go)
{
var sceneViews = SceneView.sceneViews;
if (sceneViews.Count >= 1)
{
SceneView view = SceneView.lastActiveSceneView;
if (!view)
view = sceneViews[0] as SceneView;
if (view)
view.MoveToView(go.transform);
}
}
// This is from GOCreationCommands
internal static void Place(GameObject go, GameObject parent)
{
if (parent != null)
{
var transform = go.transform;
Undo.SetTransformParent(transform, parent.transform, "Reparenting");
transform.localPosition = Vector3.zero;
transform.localRotation = Quaternion.identity;
transform.localScale = Vector3.one;
go.layer = parent.layer;
if (parent.GetComponent<RectTransform>())
ObjectFactory.AddComponent<RectTransform>(go);
}
else
{
PlaceGameObjectInFrontOfSceneView(go);
StageUtility.PlaceGameObjectInCurrentStage(go); // may change parent
go.transform.position = new Vector3(go.transform.position.x, go.transform.position.y, 0);
}
// Only at this point do we know the actual parent of the object and can modify its name accordingly.
GameObjectUtility.EnsureUniqueNameForSibling(go);
Undo.SetCurrentGroupName("Create " + go.name);
//EditorWindow.FocusWindowIfItsOpen<SceneHierarchyWindow>();
Selection.activeGameObject = go;
}
static Light2D CreateLight(MenuCommand menuCommand, Light2D.LightType type, Vector3[] shapePath = null)
{
var lightName = type != Light2D.LightType.Point ? type.ToString() : "Spot";
GameObject go = ObjectFactory.CreateGameObject(lightName + " Light 2D", typeof(Light2D));
Light2D light2D = go.GetComponent<Light2D>();
light2D.batchSlotIndex = LightBatch.batchSlotIndex;
light2D.lightType = type;
if (shapePath != null && shapePath.Length > 0)
light2D.shapePath = shapePath;
var parent = menuCommand.context as GameObject;
Place(go, parent);
Analytics.LightDataAnalytic lightData = new Analytics.LightDataAnalytic(light2D.GetInstanceID(), true, light2D.lightType);
Analytics.Renderer2DAnalytics.instance.SendData(lightData);
return light2D;
}
static bool CreateLightValidation()
{
return Light2DEditorUtility.IsUsing2DRenderer();
}
[MenuItem("GameObject/Light/Freeform Light 2D/Square", priority = CoreUtils.Sections.section3 + CoreUtils.Priorities.gameObjectMenuPriority + 4)]
static void CreateSquareFreeformLight2D(MenuCommand menuCommand)
{
CreateLight(menuCommand, Light2D.LightType.Freeform, FreeformPathPresets.CreateSquare());
}
[MenuItem("GameObject/Light/Freeform Light 2D/Circle", priority = CoreUtils.Sections.section3 + CoreUtils.Priorities.gameObjectMenuPriority + 5)]
static void CreateCircleFreeformLight2D(MenuCommand menuCommand)
{
CreateLight(menuCommand, Light2D.LightType.Freeform, FreeformPathPresets.CreateCircle());
}
[MenuItem("GameObject/Light/Freeform Light 2D/Isometric Diamond", priority = CoreUtils.Sections.section3 + CoreUtils.Priorities.gameObjectMenuPriority + 6)]
static void CreateIsometricDiamondFreeformLight2D(MenuCommand menuCommand)
{
CreateLight(menuCommand, Light2D.LightType.Freeform, FreeformPathPresets.CreateIsometricDiamond());
}
[MenuItem("GameObject/Light/Freeform Light 2D/Hexagon Flat Top", priority = CoreUtils.Sections.section3 + CoreUtils.Priorities.gameObjectMenuPriority + 7)]
static void CreateHexagonFlatTopFreeformLight2D(MenuCommand menuCommand)
{
CreateLight(menuCommand, Light2D.LightType.Freeform, FreeformPathPresets.CreateHexagonFlatTop());
}
[MenuItem("GameObject/Light/Freeform Light 2D/Hexagon Pointed Top", priority = CoreUtils.Sections.section3 + CoreUtils.Priorities.gameObjectMenuPriority + 8)]
static void CreateHexagonPointedTopFreeformLight2D(MenuCommand menuCommand)
{
CreateLight(menuCommand, Light2D.LightType.Freeform, FreeformPathPresets.CreateHexagonPointedTop());
}
[MenuItem("GameObject/Light/Sprite Light 2D", priority = CoreUtils.Sections.section3 + CoreUtils.Priorities.gameObjectMenuPriority + 1)]
static void CreateSpriteLight2D(MenuCommand menuCommand)
{
Light2D light = CreateLight(menuCommand, Light2D.LightType.Sprite);
ResourceReloader.ReloadAllNullIn(light, UniversalRenderPipelineAsset.packagePath);
}
[MenuItem("GameObject/Light/Spot Light 2D", priority = CoreUtils.Sections.section3 + CoreUtils.Priorities.gameObjectMenuPriority + 2)]
static void CreatePointLight2D(MenuCommand menuCommand)
{
CreateLight(menuCommand, Light2D.LightType.Point);
}
[MenuItem("GameObject/Light/Global Light 2D", priority = CoreUtils.Sections.section3 + CoreUtils.Priorities.gameObjectMenuPriority + 3)]
static void CreateGlobalLight2D(MenuCommand menuCommand)
{
CreateLight(menuCommand, Light2D.LightType.Global);
}
[MenuItem("GameObject/Light/Freeform Light 2D/Isometric Diamond", true)]
[MenuItem("GameObject/Light/Freeform Light 2D/Square", true)]
[MenuItem("GameObject/Light/Freeform Light 2D/Circle", true)]
[MenuItem("GameObject/Light/Freeform Light 2D/Hexagon Flat Top", true)]
[MenuItem("GameObject/Light/Freeform Light 2D/Hexagon Pointed Top", true)]
[MenuItem("GameObject/Light/Sprite Light 2D", true)]
[MenuItem("GameObject/Light/Spot Light 2D", true)]
[MenuItem("GameObject/Light/Global Light 2D", true)]
static bool CreateLight2DValidation()
{
return CreateLightValidation();
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812")]
internal class CreateUniversalPipelineAsset : EndNameEditAction
{
public override void Action(int instanceId, string pathName, string resourceFile)
{
//Create asset
AssetDatabase.CreateAsset(UniversalRenderPipelineAsset.Create(CreateRendererAsset(pathName, RendererType._2DRenderer)), pathName);
}
}
[MenuItem("Assets/Create/Rendering/URP Asset (with 2D Renderer)", priority = CoreUtils.Sections.section2 + CoreUtils.Priorities.assetsCreateRenderingMenuPriority)]
static void CreateUniversalPipeline()
{
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, UniversalRenderPipelineAsset.CreateInstance<CreateUniversalPipelineAsset>(),
"New Universal Render Pipeline Asset.asset", null, null);
}
[MenuItem("Assets/Create/Rendering/URP 2D Renderer", priority = CoreUtils.Sections.section3 + CoreUtils.Priorities.assetsCreateRenderingMenuPriority + 1)]
static void Create2DRendererData()
{
Renderer2DMenus.Create2DRendererData((instance) =>
{
Analytics.RenderAssetAnalytic modifiedData = new Analytics.RenderAssetAnalytic(instance.GetInstanceID(), true, 1, 2);
Analytics.Renderer2DAnalytics.instance.SendData(modifiedData);
});
}
}
}

View File

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

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 95000b81b3fc6af4a916987efa80abbc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

View File

@@ -0,0 +1,115 @@
fileFormatVersion: 2
guid: ec2f01df0bb1bfe459b5562a9e71c8d4
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 02ab4512457271c48afa84879f6d3848
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: 68e5bb6e60bebc046b26d3c3100a523b
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: 8f5dd14b314efbe4684329d8a14bbe38
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: e957854850ccb7140a538f7a93f8761b
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,221 @@
fileFormatVersion: 2
guid: 6eaa9958d83ec43499e946a21edba283
TextureImporter:
internalIDToNameTable:
- first:
213: 1287649992867056945
second: PointLight@64_0
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: CloudRendering
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Switch
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: GameCoreXboxOne
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: GameCoreScarlett
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: PointLight@64_0
rect:
serializedVersion: 2
x: 11
y: 2
width: 42
height: 62
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 13d00e3a8d6aed110800000000000000
internalID: 1287649992867056945
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
PointLight@64_0: 1287649992867056945
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: 8839c54710da3374f994e12f39b6d65f
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: fb7e2c1cde476854fb7067dcca74511a
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 0
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: Nintendo Switch
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 935e58b5051eebb458387c2c3bd1e082
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: 108e201829ab4214383a5467adbc0086
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 0
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: Nintendo Switch
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: ea5038a38b686be48a54da962b177940
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1,151 @@
fileFormatVersion: 2
guid: 02232385c7b444348987d74db8dd7b2e
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 0
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: Nintendo Switch
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 75f594de4db3c3644ad536fd16a13118
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: f4f779c88fa8c514d970afbd68ff6b3f
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 0
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: Nintendo Switch
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: d444217a2a2ce134fa0126b34043bf4a
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: b42c95bdd7efefc43900dbbedc4a39f8
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 0
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: Nintendo Switch
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: a80a03b4d28bde14c800557718b1b411
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -0,0 +1,139 @@
fileFormatVersion: 2
guid: a58fea03b14b2be4295b11f21a57a6f7
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 0
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: Nintendo Switch
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5943bf8e0c8a40c458cce0f4d2af5f1c
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,103 @@
fileFormatVersion: 2
guid: 7cba34d70552e144586a4d3ce4a33de5
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e5f7648dfb00c83428a633efe7759b19
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,91 @@
fileFormatVersion: 2
guid: c89564426827c76479d8772adb43e6e4
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,91 @@
fileFormatVersion: 2
guid: 7f923c32ff8dfab40b5673135ddb6cd4
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,91 @@
fileFormatVersion: 2
guid: 302e68dd45b9b2d4194ff0f7f454436f
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,91 @@
fileFormatVersion: 2
guid: e1feb27120f96ae4ea48e922cbfd93da
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,91 @@
fileFormatVersion: 2
guid: 70d16a5f04690d74ab9b1ddcbefd47bb
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -0,0 +1,98 @@
fileFormatVersion: 2
guid: 4a0aca3a5f2effb41b43cc0a1661d845
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
spriteGenerateDepthMesh: 0
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
shadowShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 53926c186e474a85a679dafcc7f45d40
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 702cc9b492bf4f6da778b0f5c996b7ad
timeCreated: 1614049029

View File

@@ -0,0 +1,29 @@
using System;
using UnityEditor.ShaderGraph;
using UnityEngine.Rendering;
namespace UnityEditor.Rendering.Universal.ShaderGraph
{
static class CreateSpriteCustomLitShaderGraph
{
[MenuItem("Assets/Create/Shader Graph/URP/Sprite Custom Lit Shader Graph", priority = CoreUtils.Sections.section1 + CoreUtils.Priorities.assetsCreateShaderMenuPriority)]
public static void CreateSpriteLitGraph()
{
var target = (UniversalTarget)Activator.CreateInstance(typeof(UniversalTarget));
target.TrySetActiveSubTarget(typeof(UniversalSpriteCustomLitSubTarget));
var blockDescriptors = new[]
{
BlockFields.VertexDescription.Position,
BlockFields.VertexDescription.Normal,
BlockFields.VertexDescription.Tangent,
BlockFields.SurfaceDescription.BaseColor,
UniversalBlockFields.SurfaceDescription.SpriteMask,
BlockFields.SurfaceDescription.NormalTS,
BlockFields.SurfaceDescription.Alpha,
};
GraphUtil.CreateNewGraphWithOutputs(new[] { target }, blockDescriptors);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a8438a1564134e1fbb2669e697bee11f
timeCreated: 1614570277

View File

@@ -0,0 +1,29 @@
using System;
using UnityEditor.ShaderGraph;
using UnityEngine.Rendering;
namespace UnityEditor.Rendering.Universal.ShaderGraph
{
static class CreateSpriteLitShaderGraph
{
[MenuItem("Assets/Create/Shader Graph/URP/Sprite Lit Shader Graph", priority = CoreUtils.Sections.section1 + CoreUtils.Priorities.assetsCreateShaderMenuPriority + 1)]
public static void CreateSpriteLitGraph()
{
var target = (UniversalTarget)Activator.CreateInstance(typeof(UniversalTarget));
target.TrySetActiveSubTarget(typeof(UniversalSpriteLitSubTarget));
var blockDescriptors = new[]
{
BlockFields.VertexDescription.Position,
BlockFields.VertexDescription.Normal,
BlockFields.VertexDescription.Tangent,
BlockFields.SurfaceDescription.BaseColor,
UniversalBlockFields.SurfaceDescription.SpriteMask,
BlockFields.SurfaceDescription.NormalTS,
BlockFields.SurfaceDescription.Alpha,
};
GraphUtil.CreateNewGraphWithOutputs(new[] { target }, blockDescriptors);
}
}
}

View File

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

View File

@@ -0,0 +1,27 @@
using System;
using UnityEditor.ShaderGraph;
using UnityEngine.Rendering;
namespace UnityEditor.Rendering.Universal.ShaderGraph
{
static class CreateSpriteUnlitShaderGraph
{
[MenuItem("Assets/Create/Shader Graph/URP/Sprite Unlit Shader Graph", priority = CoreUtils.Sections.section1 + CoreUtils.Priorities.assetsCreateShaderMenuPriority)]
public static void CreateSpriteUnlitGraph()
{
var target = (UniversalTarget)Activator.CreateInstance(typeof(UniversalTarget));
target.TrySetActiveSubTarget(typeof(UniversalSpriteUnlitSubTarget));
var blockDescriptors = new[]
{
BlockFields.VertexDescription.Position,
BlockFields.VertexDescription.Normal,
BlockFields.VertexDescription.Tangent,
BlockFields.SurfaceDescription.BaseColor,
BlockFields.SurfaceDescription.Alpha,
};
GraphUtil.CreateNewGraphWithOutputs(new[] { target }, blockDescriptors);
}
}
}

View File

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

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b0e1457667cf4865bf50a0f8567c4d29
timeCreated: 1614049038

View File

@@ -0,0 +1,51 @@
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/SurfaceData2D.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging2D.hlsl"
half4 _RendererColor;
PackedVaryings vert(Attributes input)
{
Varyings output = (Varyings)0;
input.positionOS = UnityFlipSprite(input.positionOS, unity_SpriteProps.xy);
output = BuildVaryings(input);
output.color *= _RendererColor * unity_SpriteColor; // vertex color has to applied here
PackedVaryings packedOutput = PackVaryings(output);
return packedOutput;
}
half4 frag(PackedVaryings packedInput) : SV_TARGET
{
Varyings unpacked = UnpackVaryings(packedInput);
UNITY_SETUP_INSTANCE_ID(unpacked);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(unpacked);
SurfaceDescription surfaceDescription = BuildSurfaceDescription(unpacked);
#ifdef UNIVERSAL_USELEGACYSPRITEBLOCKS
half4 color = surfaceDescription.SpriteColor;
#else
half4 color = half4(surfaceDescription.BaseColor, surfaceDescription.Alpha);
#endif
#if defined(DEBUG_DISPLAY)
SurfaceData2D surfaceData;
InitializeSurfaceData(color.rgb, color.a, surfaceData);
InputData2D inputData;
InitializeInputData(unpacked.positionWS.xy, half2(unpacked.texCoord0.xy), inputData);
half4 debugColor = 0;
SETUP_DEBUG_DATA_2D(inputData, unpacked.positionWS, unpacked.positionCS);
if (CanDebugOverrideOutputColor(surfaceData, inputData, debugColor))
{
return debugColor;
}
#endif
// Disable vertex color multiplication. Users can get the color from VertexColor node
#if !defined(HAVE_VFX_MODIFICATION) && !defined(_DISABLE_COLOR_TINT)
color *= unpacked.color;
#endif
return color;
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 4ad8b54817d9f5441910014b5ceb8583
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,74 @@
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/SurfaceData2D.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging2D.hlsl"
#if USE_SHAPE_LIGHT_TYPE_0
SHAPE_LIGHT(0)
#endif
#if USE_SHAPE_LIGHT_TYPE_1
SHAPE_LIGHT(1)
#endif
#if USE_SHAPE_LIGHT_TYPE_2
SHAPE_LIGHT(2)
#endif
#if USE_SHAPE_LIGHT_TYPE_3
SHAPE_LIGHT(3)
#endif
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/CombinedShapeLightShared.hlsl"
half4 _RendererColor;
PackedVaryings vert(Attributes input)
{
Varyings output = (Varyings)0;
UNITY_SETUP_INSTANCE_ID(input);
SetUpSpriteInstanceProperties();
input.positionOS = UnityFlipSprite(input.positionOS, unity_SpriteProps.xy);
output = BuildVaryings(input);
output.color *= _RendererColor * unity_SpriteColor; // vertex color has to applied here
#if defined(DEBUG_DISPLAY)
output.normalWS = TransformObjectToWorldNormal(input.normalOS);
#endif
PackedVaryings packedOutput = PackVaryings(output);
return packedOutput;
}
half4 frag(PackedVaryings packedInput) : SV_TARGET
{
Varyings unpacked = UnpackVaryings(packedInput);
UNITY_SETUP_INSTANCE_ID(unpacked);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(unpacked);
SurfaceDescription surfaceDescription = BuildSurfaceDescription(unpacked);
#ifdef UNIVERSAL_USELEGACYSPRITEBLOCKS
half4 color = surfaceDescription.SpriteColor;
#else
half4 color = half4(surfaceDescription.BaseColor, surfaceDescription.Alpha);
#endif
#if ALPHA_CLIP_THRESHOLD
clip(color.a - surfaceDescription.AlphaClipThreshold);
#endif
// Disable vertex color multiplication. Users can get the color from VertexColor node
#if !defined(HAVE_VFX_MODIFICATION) && !defined(_DISABLE_COLOR_TINT)
color *= unpacked.color;
#endif
SurfaceData2D surfaceData;
InitializeSurfaceData(color.rgb, color.a, surfaceDescription.SpriteMask, surfaceDescription.NormalTS, surfaceData);
InputData2D inputData;
InitializeInputData(unpacked.texCoord0.xy, half2(unpacked.screenPosition.xy / unpacked.screenPosition.w), inputData);
#if defined(DEBUG_DISPLAY)
SETUP_DEBUG_DATA_2D(inputData, unpacked.positionWS, unpacked.positionCS);
surfaceData.normalWS = unpacked.normalWS;
#endif
return CombinedShapeLightShared(surfaceData, inputData);
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3ce18356597793947bd0f671f7363559
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,36 @@
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl"
PackedVaryings vert(Attributes input)
{
Varyings output = (Varyings)0;
input.positionOS = UnityFlipSprite(input.positionOS, unity_SpriteProps.xy);
output = BuildVaryings(input);
output.color *= unity_SpriteColor;
output.normalWS = -GetViewForwardDir();
PackedVaryings packedOutput = PackVaryings(output);
return packedOutput;
}
half4 frag(PackedVaryings packedInput) : SV_TARGET
{
Varyings unpacked = UnpackVaryings(packedInput);
UNITY_SETUP_INSTANCE_ID(unpacked);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(unpacked);
SurfaceDescription surfaceDescription = BuildSurfaceDescription(unpacked);
#ifdef UNIVERSAL_USELEGACYSPRITEBLOCKS
half4 color = surfaceDescription.SpriteColor;
#else
half4 color = half4(1.0,1.0,1.0, surfaceDescription.Alpha);
#endif
#if ALPHA_CLIP_THRESHOLD
clip(color.a - surfaceDescription.AlphaClipThreshold);
#endif
half crossSign = (unpacked.tangentWS.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale();
half3 bitangent = crossSign * cross(unpacked.normalWS.xyz, unpacked.tangentWS.xyz);
return NormalsRenderingShared(color, surfaceDescription.NormalTS, unpacked.tangentWS.xyz, bitangent, unpacked.normalWS);
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 39ce338156d9f6b40b4702eb2d26d40d
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,69 @@
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/SurfaceData2D.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging2D.hlsl"
half4 _RendererColor;
PackedVaryings vert(Attributes input)
{
Varyings output = (Varyings)0;
UNITY_SETUP_INSTANCE_ID(input);
SetUpSpriteInstanceProperties();
input.positionOS = UnityFlipSprite(input.positionOS, unity_SpriteProps.xy);
output = BuildVaryings(input);
output.color *= _RendererColor * unity_SpriteColor; // vertex color has to applied here
#if defined(DEBUG_DISPLAY)
output.normalWS = TransformObjectToWorldNormal(input.normalOS);
#endif
PackedVaryings packedOutput = PackVaryings(output);
return packedOutput;
}
half4 frag(PackedVaryings packedInput) : SV_TARGET
{
Varyings unpacked = UnpackVaryings(packedInput);
UNITY_SETUP_INSTANCE_ID(unpacked);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(unpacked);
SurfaceDescription surfaceDescription = BuildSurfaceDescription(unpacked);
#ifdef UNIVERSAL_USELEGACYSPRITEBLOCKS
half4 color = surfaceDescription.SpriteColor;
#else
half4 color = half4(surfaceDescription.BaseColor, surfaceDescription.Alpha);
#endif
if (color.a == 0.0)
discard;
#if ALPHA_CLIP_THRESHOLD
clip(color.a - surfaceDescription.AlphaClipThreshold);
#endif
#if defined(DEBUG_DISPLAY)
SurfaceData2D surfaceData;
InitializeSurfaceData(color.rgb, color.a, surfaceData);
surfaceData.normalWS = unpacked.normalWS;
#if (SHADERPASS == SHADERPASS_SPRITELIT)
surfaceData.normalTS = surfaceDescription.NormalTS;
#endif
InputData2D inputData;
InitializeInputData(unpacked.positionWS.xy, half2(unpacked.texCoord0.xy), inputData);
half4 debugColor = 0;
SETUP_DEBUG_DATA_2D(inputData, unpacked.positionWS, unpacked.positionCS);
if (CanDebugOverrideOutputColor(surfaceData, inputData, debugColor))
{
return debugColor;
}
#endif
// Disable vertex color multiplication. Users can get the color from VertexColor node
#if !defined(HAVE_VFX_MODIFICATION) && !defined(_DISABLE_COLOR_TINT)
color *= unpacked.color;
#endif
return color;
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 172e304acf14e434e967133e7ee67273
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f270bf32cbff4c02ae07004a815c5632
timeCreated: 1614049109

Some files were not shown because too many files have changed in this diff Show More