Unity-Technologies / Unity-Technologies/Unity.Mathematics

Add implicit cast from floatN/halfN to UnityEngine.Color and back

Open
#105 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
1.4k
Forks
159
PR merge metrics
No merged PRs in 30d

Description

It would be nice to be able to implicitly cast from a color to a vector and back.
Currently I'm using an extension method like this, but I it would be nicer to just cast from one to the other.

public static class Extensions
{
public static float3 ToFloat3(this Color c)
{
return new float3(c.r, c.b, c.b);
}
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the vector types named in the request, including floatN and halfN, and the UnityEngine.Color conversion entry points. Determine which color-to-vector and vector-to-color conversions are intended, then verify that the implicit casts cover the requested types in both directions. The issue does not name files or tests, so the relevant definitions and validation coverage must be found in the repository.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.