Author Topic: UIButtonColor material error  (Read 4243 times)

vidjogamer

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 48
    • View Profile
UIButtonColor material error
« on: January 23, 2014, 10:57:11 AM »
Just wanted to know if I should ignore this or if I should change it to sharedMaterial like Unity suggests. The errors are pretty annoying.

Instantiating material due to calling renderer.material during edit mode. This will leak materials into the scene. You most likely want to use renderer.sharedMaterial instead.
UnityEngine.Renderer:get_material()
UIButtonColor:Init() (at Assets/NGUI/Scripts/Interaction/UIButtonColor.cs:123)
UIButtonColor:Start() (at Assets/NGUI/Scripts/Interaction/UIButtonColor.cs:73)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIButtonColor material error
« Reply #1 on: January 24, 2014, 08:42:44 AM »
I'm guessing that happens at edit time? Change that line to:
  1. mColor = Application.isPlaying ? ren.material.color : ren.sharedMaterial.color;

vidjogamer

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 48
    • View Profile
Re: UIButtonColor material error
« Reply #2 on: January 24, 2014, 06:37:54 PM »
Ok. Cool thanks. Are you going to change it in the next update?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIButtonColor material error
« Reply #3 on: January 24, 2014, 10:23:56 PM »
Yup. Already changed for Pro users.