If Renge's answer is not working for you. Try using type.FullName instead. Fixed it for me in Unity 6.