Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How do i remove a shader component?

Discussion in 'Editor & General Support' started by Tiles, Aug 9, 2011.

  1. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,481
    I`ve added a shader component to a trigger object. A simple cube. Then i realized that i don`t need a shader for a invisible object. And tried to remove it. But i cannot. There is no menu item for it.

    How do i remove a shader component?
     
    wmd800 likes this.
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    A shader isn't a component, it's part of a material, which is part of a Mesh Renderer component. You can remove Mesh Renderer components in the usual way.

    --Eric
     
    GameJob2017, wmd800 and pugnaciousg like this.
  3. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,481
    Thanks Eric :)
     
  4. NextWorldVR

    NextWorldVR

    Joined:
    Dec 30, 2017
    Posts:
    14
    And that way is??? When you click the gear of a shader in a mesh renderer there are 3 options,
    Reset
    Select Shader
    Edit Shader

    None of those are Delete or Remove so,.. 7 years later, Again; HOW DO I REMOVE A SHADER (COMPONENT OR NOT! ;") IN A MESH RENDERER?

    The usual way would fine, can you impart that info to save time?

    Thanks,..
     
    TractGames and GameJob2017 like this.
  5. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    Shader are assets and not components.
    For all non build in shader you can use the "Select Shader" to select the shader file in the Project view (given that the project view is opend)
    Then you can remove the shader from your project.
    If you like to remove the shader for performance reasons you can just choose another shader on your materials and unity will not include it into the build.
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Rick-click on the component and select "remove component".

    --Eric
     
  7. KingsHere

    KingsHere

    Joined:
    Nov 3, 2015
    Posts:
    3
    In my scenario, my object was having more materials than needed. Thus,
    For people looking for removing all or some of the materials from the mesh, there is a "SkinnedMeshRenderer" script attahced to the same object having these materials. In that script component there is a list of Materials, click on the variable the list will drop down. Now reducing the number here will get rid of extra materials. Beware, you might remove more materials than needed and miss the right Material references.
     
  8. FranciscoCaldeira

    FranciscoCaldeira

    Joined:
    Sep 30, 2019
    Posts:
    2
    In 2019.. looking to remove a shader in a easy way..
     
    multvers likes this.
  9. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,796
  10. Cosmology27

    Cosmology27

    Joined:
    Jul 11, 2019
    Posts:
    61
    Sorry for the necro here, but I still don't get it. I have a bunch of objects that I applied a wood material to, and they look great. I duplicated the bottom, and dragged it up, so it would be the top. Problem is, it obviously has the wood material. I want to change that to the glass material. There is no option, anywhere I can see, to remove the material, and when I click "select material" it takes me to the materials folder, but it doesn't let me actually do anything. All I'm doing is looking at and clicking the materials, but they don't apply to the object. If I try to drag and drop the glass material on the top object, it doesn't work either. I just want to switch out materials, so I'm quite confused why it's difficult to figure out. I'm sure there's an easy answer, but I can't find it.
    Thanks for any help you can provide!
     
  11. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,365
    THe mesh renderer has a list of materials.
    https://docs.unity3d.com/Manual/class-MeshRenderer.html
    you can see on that docs page, there is 1 material and it's set to "default-material". You can drag any other material into that slot and it will replace the material that's already there.

    You could also click the circle on the right side of the slot and it will bring-up a list of all of the materials in your project and you can select one there. Usually I find this second method to be difficult, due to the amount of materials in my project overall.


    Probably the easiest way to set a material for an object is to drag the material from the inspector to any object in the scene view.

    Edit: one more thing that might be relevant is that if you want to change the materials on an imported model that already has materials, I think you need to go to the model's import options and select "extract materials". This is new feature that wasn't around when this thread first started.
     
    Nikovsk, Flarenee and Cosmology27 like this.