Search Unity

_World2Object with multiple objects.

Discussion in 'Shaders' started by naked_chicken, Apr 28, 2014.

  1. naked_chicken

    naked_chicken

    Joined:
    Sep 10, 2012
    Posts:
    186
    So I've got a shader that uses _World2Object. With one object using said shader everything works great. My generated world uv's are converted to object uv's and everyone's happy. The problem comes when I duplicate the object. As soon as there are two of them on-screen then the uv's get moved back to 0,0. If I use a script that writes the object's worldToLocal matrix and assign that to its individual material then everything works great. This makes an instance of the material for every object, though, and also means leaking materials in edit mode.

    So is instancing the only option?
     
  2. Cjreek

    Cjreek

    Joined:
    Apr 23, 2013
    Posts:
    33