Git Product home page Git Product logo

unitycolorpalette's Introduction

ColorPalette System

Overview

The ColorPalette system is designed to allow artists to easily create a custom palette of colors and name or tag them within Unity. These colors can be accessed in scripts through their names or tags.

Components

ColorPalette

The ColorPalette is a ScriptableObject that holds a collection of ColorPaletteEntry objects. Each entry represents a named color.

Creating a ColorPalette

  1. Right-click in the Project panel.
  2. Select Create > ScriptableObjects > ColorPalette.
  3. Name the new ColorPalette asset.
  4. Select the ColorPalette to edit it in the Inspector.
  5. Add, edit, or remove color entries as needed.

Accessing Colors in Scripts

Use the GetColor(string name) method to retrieve a color by its name or tag.

Color color = colorPalette.GetColor("TagName");

ColorPaletteEntry

This class defines a color entry within the ColorPalette. It includes two public fields:

  • ColorName: The name of tag of the color.
  • Color: The color itself.

These fields can be edited directly within the Unity inspector when editing a ColorPalette.

Limitations and Notes

  • Colors cannot be added to the palette at runtime in the editor.
  • Changes to colors in the palette while the game is running in the editor will be reflected in real time, but will revert to their original values when the games stops. This behaviour is consistent with Unity's handling of all game objects and is not specific to the ColorPalette system.

unitycolorpalette's People

Contributors

dasher83 avatar

Stargazers

TJ avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.