I tried to get background color of the button. it cannot find it. Is there anything wrong in my setting?
backButton.style.backgroundColor
error message:
Unable to find member ‘backgroundColor’ for ‘backButton. style’
无法找到“backButton.style”的成员“backgroundColor” (Visual Studio in Chinese)
The member definitely exists: Unity - Scripting API: UIElements.IStyle.backgroundColor
Are you mistakingly using the UnityEngine.UI.Button
class instead?
the backButton is UnityEngine.UIElements.Button.
backButton.style:
backButton.style
{UnityEngine.UIElements.InlineStyleAccess}
base: {UnityEngine.UIElements.InlineStyleAccess}
inlineRule: {UnityEngine.UIElements.InlineStyleAccess.InlineRule}
m_InlineBackgroundSize: “(sizeType:Length x:0, y:0)”
I will try to upgrade unity version to 6000.
I found answer.
I should use button.resovledStyle.backgroundColor