Author Topic: Use materials in decorators  (Read 307 times)

El Chile

  • Newbie
  • *
  • Posts: 22
    • View Profile
Use materials in decorators
« on: May 21, 2019, 07:00:59 PM »
Hi Kronnect,

One feature I'd like to request is to be able to use materials as decorators instead of textures and colors. There are a few shaders I'd like to implement on top of certain countries and the ability to do this with the decorator system would be amazing!

Thanks!

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4887
    • View Profile
Re: Use materials in decorators
« Reply #1 on: May 22, 2019, 09:25:16 AM »
Nice request. One way to implement that is to fetch the gameobject associated to the surface (any CountryToggleSurface or similar returns a reference to it) and simply assign your material to the renderer.
However you will need to prevent highlighting on those countries and it will restore the standard material once it's off.

El Chile

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Use materials in decorators
« Reply #2 on: May 22, 2019, 09:29:43 PM »
interesting idea! I'll try that. Thanks!

El Chile

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Use materials in decorators
« Reply #3 on: May 23, 2019, 09:32:55 PM »
Well that worked :)

Having the materials is great, but I have one more question; when I try to put a texture on the material, it doesn't seem to appear on the map (even if set to repeat wrap mode); instead I just see a single color. I believe this is due how to it samples the material given the UVs. When using the 'CountryToggle' method, what are the uv coordinates of the returned gameobject; is is the whole map or is it based on the country itself?

I'm attaching a screenshot to better explain myself. Thanks!

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4887
    • View Profile
Re: Use materials in decorators
« Reply #4 on: May 23, 2019, 10:03:20 PM »
Thatís correct.
When calling ToggleCountrySurface without passing a texture, the resulting mesh doesnít have UV data (for optimization). Just pass Texture2D.White or any other dummy texture when calling ToggleCountrySurface and it will work.