UIEffect icon indicating copy to clipboard operation
UIEffect copied to clipboard

UIEffectBase.OnValidate may be disabled when game running

Open ltccss opened this issue 3 years ago • 0 comments

NOTE: Your issue may already be reported! Please search on the issue tracker before creating one.

Is your feature request related to a problem? Please describe. I pushed those UI-EFFECT materials into a shared asset bundle, and load all the ui assets via asset bundles (with Unity's dependence system).

Firstly I found the UI-Effect-Transition component doesn't work in mobile phone but it's OK when in Editor(also load assets via AB).

this puzzles me for a long time, and then I find this:

protected override void OnValidate()
{
	base.OnValidate ();

	var mat = GetMaterial();
	if (m_EffectMaterial != mat)
	{
		m_EffectMaterial = mat;
		UnityEditor.EditorUtility.SetDirty(this);
	}

	ModifyMaterial();
	SetVerticesDirty ();
	SetDirty ();
}

It seems when in editor mode, m_EffectMaterial will always be checked.

Otherwise, I stopped OnValidate() temporarily and found that if I turn off the KeyWord "UIEFFECT_SEPARATE" in MaterialResolver, a lot of sub material assets will be generated into one material asset (such as "UI-Effect-Transition"), which causes that the UI EFFECT component(such as UITransitionEffect) fails to find its material when deserialized from bundle. (It seems a Unity bug about asset bundle system?) (Sorry for no example project provided, it's rather complicated to make one)

the Unity version is 2018.4.21f1

ltccss avatar Jan 21 '21 10:01 ltccss