Attribute name was wrong in the OnRender function
Changed the name of the states and the texture should be protected now