Fix the foreground icon not tinted with the button.

This commit is contained in:
2023-12-19 14:55:45 +08:00
parent 58091ad534
commit 81d458f7de
3 changed files with 99 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
using UnityEngine;
namespace Cryville.Common.Unity.UI {
[ExecuteAlways]
[RequireComponent(typeof(CanvasRenderer))]
public class CanvasRendererColorLinker : MonoBehaviour {
[SerializeField] CanvasRenderer m_source;
CanvasRenderer _target;
void Awake() {
_target = GetComponent<CanvasRenderer>();
}
void Update() {
if (m_source == null) return;
_target.SetColor(m_source.GetColor());
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5f490a9cc1b652746b3062810e200ec5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: