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
  4. Dismiss Notice

Unity 5.5 change a group of images filter mode using C#

Discussion in 'Scripting' started by DarkCSFixer, Mar 19, 2017.

  1. DarkCSFixer

    DarkCSFixer

    Joined:
    Feb 24, 2017
    Posts:
    19
    I noticed that 2D sprites don't look very good in Point and Billinear, so I want to set up a button that allows the player to easily switch the sprite's filter between the two. I been googling the code all day, but it's all for before Unity 5 which apparently doesn't work anymore in 5.

    I apparently want Untity 5 version of this:
    renderer.material.mainTexture.filterMode = FilterMode.Point;

    I just starting writing code, and I'm very good at it, so I honestly don't understand any of this. Sorry.
     
  2. mikael_juhala

    mikael_juhala

    Joined:
    Mar 9, 2015
    Posts:
    247
  3. DarkCSFixer

    DarkCSFixer

    Joined:
    Feb 24, 2017
    Posts:
    19
    I'm not sure. I don't really understand how to write the code. Could you give me an example for changing images in a certain folder to a different type of FilterMode?
     
  4. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    8,972
    Once built, folders don't exist anymore. You will need to set them when they are used, either when instantiated, or you will need to find them in place. There really isn't a simple way to it, you'll need create a system to handle it, and how it will work will vary depending on your project architecture. I would suggest just using whichever looks best, you are looking at a fair amount of work.