playMaker

Author Topic: Any way to change the shader type of all materials in a scene?  (Read 3858 times)

Ghosu

  • Playmaker Newbie
  • *
  • Posts: 10
Any way to change the shader type of all materials in a scene?
« on: December 15, 2015, 05:37:37 AM »
Hello

I'm currently working on a prototype for a game and want to change the shader type of all materials in the scene at runtine to test different art style variations.

Ofc i could drag and drop each single material and set property at key down or compile an alternative version, but maybe there is a more efficient way that i'm not aware of.



Offtopic: Many thanks to the creators of this awesome tool. I'm a 3D artist and allrounder and tend to do as much as possible on my own. Tried to learn coding a year ago, couldn't get my head around it...as an artist i'm more of a visual type, so i abandoned this task quite quickly. Now, using Playmaker, i have a visual interface to accomplish my tasks and learn a bit coding alongside - thank you sooo much :)

greetings


dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Any way to change the shader type of all materials in a scene?
« Reply #1 on: December 15, 2015, 10:42:28 AM »
cool worlds..

use set material action.

 ;)

Ghosu

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Any way to change the shader type of all materials in a scene?
« Reply #2 on: December 15, 2015, 12:23:55 PM »
Thanks. Well, isn't set material not quite as costly as using set property (as mentioned before)? I'm using 'bout 40 materials (random generated planets) so i've got to handle each single one. Whatever, wouldn't be a big deal to set it up this way - i'm just wondering if there is any other, more efficient, solution (like locating all materials in the scene and simply change all their standard shader to toon) :)

greetings

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Any way to change the shader type of all materials in a scene?
« Reply #3 on: December 15, 2015, 01:54:04 PM »
you could have two material (x + toon), have the textures in array and then set material and set the texture when needed. Different texture on same material..

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3998
  • Official Playmaker Support
    • LinkedIn
Re: Any way to change the shader type of all materials in a scene?
« Reply #4 on: December 15, 2015, 03:47:59 PM »
It might be easiest to just use Unity multi-object editing to do this:
Select all the materials you want to change and multi-edit them in the Inspector to change the shader.

You could make a Favorites search for the materials (like the All Materials search) or keep them in one folder for easy selection.

This is assuming you're okay testing in the editor and don't need to make a standalone build...


Ghosu

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Any way to change the shader type of all materials in a scene?
« Reply #5 on: December 15, 2015, 04:19:40 PM »
This is exactly the way i'm doing it right now :D

I'll simply do it the "set property" way for each single one...just takes a few minutes to set it up so it's no big deal. Was just curious if there is a some way (for upcoming projects with more materials) to do it with one or two actions, like selecting all material in the scene and change shader.

Thanks for your time :)
Greetings

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3998
  • Official Playmaker Support
    • LinkedIn
Re: Any way to change the shader type of all materials in a scene?
« Reply #6 on: December 15, 2015, 04:38:00 PM »
Yeah, now that we have array support in 1.8.0 I'm playing around with an idea for Selection Actions. Basically letting you build a search that populates an array, so you can quickly perform actions on that selection.

The idea would be to have a modular system for building searches so you could make quite complex selections. Kind of like online SQL query builders, letting you combine SELECT, WHERE, AND, OR etc. User friendly but powerful.