This commit is contained in:
2026-08-21 17:59:13 +03:00
parent b98901c366
commit f6a7547e84
951 changed files with 909007 additions and 70938 deletions
@@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(RampAsset))]
public class RampAssetEditor : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
if (GUILayout.Button("Bake"))
Bake();
}
void Bake()
{
var r = target as RampAsset;
var t = new Texture2D(r.size, r.size, TextureFormat.ARGB32, mipChain: true);
var p = t.GetPixels();
for (var x = 0; x < r.size; x++)
for (var y = 0; y < r.size; y++)
p[r.up ? y + (r.size - x - 1) * r.size : x + y * r.size] = r.gradient.Evaluate(x * 1f / r.size);
t.SetPixels(p);
t.Apply();
var bytes = t.EncodeToPNG();
var path = AssetDatabase.GetAssetPath(r).Replace(".asset", "") + ".png";
if (!r.overwriteExisting)
path = AssetDatabase.GenerateUniqueAssetPath(path);
System.IO.File.WriteAllBytes(path, bytes);
AssetDatabase.Refresh();
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 0939ef1fe67b3477e8058638b5924ab5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 127325
packageName: Particle Pack
packageVersion: 3.1
assetPath: Assets/UnityTechnologies/EffectExamples/Shared/Ramps/Editor/RampAssetEditor.cs
uploadId: 691001