-
-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`SoftMask.alpha` is obsolete because it can be replaced by `Graphic.color.a`. Run `ProjectSettings > UI > SoftMask > Upgrade All Assets V1 to V2` to change this. close #172
- Loading branch information
Showing
6 changed files
with
96 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
Packages/src/Editor/AssetModification/SoftMaskComponentModifier_Alpha.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Coffee.UISoftMaskInternal.AssetModification; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
#pragma warning disable CS0612, CS0618 // Type or member is obsolete | ||
|
||
namespace Coffee.UISoftMask | ||
{ | ||
internal class SoftMaskComponentModifier_Alpha : ComponentModifier<SoftMask> | ||
{ | ||
protected override bool ModifyComponent(SoftMask softMask, bool dryRun) | ||
{ | ||
if (softMask.m_Alpha < 0 || 1 <= softMask.m_Alpha) return false; | ||
|
||
if (!dryRun) | ||
{ | ||
softMask.alpha = softMask.m_Alpha; | ||
softMask.m_Alpha = -1; | ||
|
||
EditorUtility.SetDirty(softMask.gameObject); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
public override string Report() | ||
{ | ||
return " -> SoftMask.alpha API has been changed. " + | ||
"Use CanvasGroup component and CanvasGroup.alpha instead.\n"; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Packages/src/Editor/AssetModification/SoftMaskComponentModifier_Alpha.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters