Converted Example code for Unity 3D