Fixed
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f49557bd9b919451fb05ad3e9855bce9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
@@ -0,0 +1,45 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 366060de70f6d41d688e416621057bb3, type: 3}
|
||||
m_Name: RampBaker
|
||||
m_EditorClassIdentifier:
|
||||
gradient:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0, g: 0, b: 0, a: 1}
|
||||
key1: {r: 1, g: 1, b: 1, a: 1}
|
||||
key2: {r: 1, g: 1, b: 1, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0.92674404, g: 0.9716981, b: 0.6921057, a: 0}
|
||||
key5: {r: 1, g: 1, b: 1, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 18936
|
||||
ctime2: 48575
|
||||
ctime3: 65535
|
||||
ctime4: 65535
|
||||
ctime5: 65535
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 4
|
||||
m_NumAlphaKeys: 2
|
||||
size: 64
|
||||
up: 1
|
||||
overwriteExisting: 0
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6964ca4c5ab465b42a92b518c40c537b
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 127325
|
||||
packageName: Particle Pack
|
||||
packageVersion: 3.1
|
||||
assetPath: Assets/UnityTechnologies/EffectExamples/Shared/Ramps/RampBaker.asset
|
||||
uploadId: 691001
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 043362eb87bb040648a7d956a077ae26
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
[CreateAssetMenu]
|
||||
public class RampAsset : ScriptableObject
|
||||
{
|
||||
public Gradient gradient = new Gradient();
|
||||
public int size = 16;
|
||||
public bool up = false;
|
||||
public bool overwriteExisting = true;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 366060de70f6d41d688e416621057bb3
|
||||
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/Runtime/RampAsset.cs
|
||||
uploadId: 691001
|
||||
Reference in New Issue
Block a user