Greetings,
I have a class that uses a sprite sheet to display animations on a quad. However, if I have more than one object using the same sheet then I need to display with uvs. So this is fine to use mesh.uv. But the problem comes in when I am using the Editor, it throws exceptions because I am using renderer.mesh not renderer.sharedMesh. But I have to use mesh because otherwise the uv’s will change on all of the objects that share the “quad” resource (Asset). Any suggestions, I will be happy just to catch that exception.
I am using the following code:
// Pseudo Code
renderer.mesh.uv = new Vector2[] { stuff here }; // (throws exception during editor mode)
renderer.sharedMesh.uv = new Vector2[] { blah blah }; // Changes all objects