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

Universal Render Pipeline

Discussion in '2D' started by Sercans1907, Apr 24, 2021.

  1. Sercans1907

    Sercans1907

    Joined:
    Mar 6, 2021
    Posts:
    2
    Hey guys

    oyunisik = isikNoktasi.GetComponent<UnityEngine.Experimental.Rendering.Universal.Light2D>();

    isikdegeri = oyunisik.volumeOpacity;
    isikdegeri = 1f;


    i cant change volumeopacity?
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,343
    That's because you're not changing it. You read it into a variable named "isikdegeri" then change that variable. That variable isn't magically linked to where you read it from. Only classes can be used a references like this but primitive value types like float, structs etc are not. This isn't how C# works so I would suggest you spend time going through some basic C# tutorials.

    You change properties like this:
    Code (CSharp):
    1. oyunisik.volumeOpacity = 1f;
     
  3. Sercans1907

    Sercans1907

    Joined:
    Mar 6, 2021
    Posts:
    2
    Thank u for answer.

    oyunisik.volumeopacity =1f; not working. because volumeopacity just use "get"

    i used oyunisik.intensity =1f;

    its solved <3

    i hope u understand me
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,343
    Right. I'm not a graphics dev. I was only responding to the fact that you cannot set ANY property the way you were doing it in C#.