The material manager provides handles for the objects which should be stored instead of the material pointer. When accessing the internal material always use the handle rather than storing the result of Get()