Skip to content

Creating and previewing elite ramps in Editor

This guide will go through creating and previewing elite ramps in Editor, without the need of external tools, like graphics editors. Explanation of how elite ramps actually work can be found here.

Prerequisites

  • Way to have shaders in the editor. You have two options:

  • A model to preview ramp on. This guide will use Sand Crab from EnemiesReturns.

  • GradientTexture package. Despite it being marked as abandoned and repo suggesting to use ProceduralTexture this package is simpler and only gives us what we need. And it works with RoR2 Unity version, both Devotion and current at the time of writing (Alloyed Collective version 1.4.1) version, so no reason to update it.

This guide will not go into explanation on how to create the Thunderkit project, how to use ReplaceShaders script with Play mode or how to install Unity package. Use the links above to get started.

The Sause

First of all, we need the EliteRampPreview script.

using UnityEngine;

namespace EditorHelpers
{
    public class EliteRempPreview : MonoBehaviour
    {
        #if UNITY_EDITOR
        public static int EliteRampPropertyID = Shader.PropertyToID("_EliteRamp");

        public static int EliteIndex = Shader.PropertyToID("_EliteIndex");

        public Texture2D eliteRamp;

        public Renderer renderer;

        private MaterialPropertyBlock propertyBlock;

        public void Awake()
        {
            propertyBlock = new MaterialPropertyBlock();
        }

        private void FixedUpdate()
        {
            SetProperties();
        }

        private void SetProperties()
        {
            renderer.GetPropertyBlock(propertyBlock);
            propertyBlock.SetTexture(EliteRampPropertyID, eliteRamp);
            propertyBlock.SetFloat(EliteIndex, 1);
            renderer.SetPropertyBlock(propertyBlock);
        }
        #endif
    }
}

Save it to EliteRampPreview.cs and put it inside your Scripts folder.

I recommend doing shader preview on an empty scene, mainly for the purposes of it loading faster. Drag your model with proper material onto the scene.

image

Now add an Elite Ramp Preview component to your model, on the same object where your Renderer is. Add Renderer to it by dragging your Renderer to the Renderer field of Elite Ramp Preview.

image

Now we need to create our ramp. Right click in your Project window, select Create -> Texture -> Gradient. You now have a scriptable object that is used to create and export gradients in Unity Editor.

image

Set the Resolution to 256x8. Height doesn't actually matter, it is solely for preview. Untick SRGB. Set Vertical Lerp to the line that follows 0. You can achieve that first by selecting the line at the bottom, then by right-clicking each node on the line, selecting Edit key and setting 0 as value.

image

Horizontal Top doesn't matter for us, we entirely remove it from our gradient by setting Vertical Lerp to 0. Our gradient will fully match Horizontal Bottom.

image

Now click on an arrow next to our gradient in Project window and select the image. Set Wrap Mode to Clamp for the image.

image

Now drag the gradient onto the Elite Ramp field of Elite Ramp Preview component. If it doesn't work (depends on Unity version), then drag the image that shows when you click the arrow.

image

Now you can press Play, wait for it to load and you will have a working elite ramp preview in Editor. You can live edit the gradient in the asset and it will reflect changes in real time.

2026-05-25 13-47-59- 00 02 190-00 15 840

When you are done you need to export it to PNG by clicking the "Encode to PNG" button on the asset since the game won't understand what GradientTexture ScriptableObject is. When you export to PNG remember to check sRGB, set Wrap Mode to Clamp and uncheck Generate Mip Maps on the newly generated asset. Preview the ramp to make sure it is the same as the one in GradientTexture.

image

Now clone your model on the scene (either by dragging a new one or pressing Ctrl-D) and apply a newly exported ramp to the clone. Start Play mode and ensure ramps match, this process allows you to double check that you selected all of the import settings correctly.

image

And once you are done I recommend removing EliteRampPreview from the model. While it basically won't do anything in game since all of the code is gated by UNITY_EDITOR it is still a useless component during runtime.

FAQ

Q: My model is basically solid color when previewing.

image

A: You forgot to set Wrap Mode to Clamp.

Q: My gradient when saving to PNG is different from my gradient in GradientTexture.

image

A: You didn't untick SRGB on GradientTexture asset or forgot to ticksRGB on PNG.