Search Unity

C# helps please. I pay in cookies.

Discussion in 'Scripting' started by keepthachange, Jul 13, 2019.

  1. keepthachange

    keepthachange

    Joined:
    Oct 15, 2014
    Posts:
    87
    Trying to get an object "ammo box"
    To deactivate if another object "the floor its on" has its shader alpha set to zero and then active if its 1.

    Its a top down game. And I have items on second floor that i would not like visible if the floor isn't.

    If it helps I'm using object fader from asset store to fade my floors. And what's being changed is the albedo transparency (a).
    I'm also using standard shader.

    I like it, it works good just need to figure out this last little hump to carry on. Thank you in advance.

    Been awhile since posted I have no idea if I'm posting in right place?
     
  2. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    1,556
    What kind of cookies?

    Sorry,I didn't understand the rest of your question. Perhaps try to describe the issue you have in more detail, and show us the code you already have?
     
  3. Lethn

    Lethn

    Joined:
    May 18, 2015
    Posts:
    1,583
    If you're looking to change the alpha of a shader you should probably look at properties in the shader graph and create one for your alpha in the master node. I'm pretty new to the shader graph though so I'm afraid I don't know how to do that yet but I'm pretty sure that would be the best way then you should be able to put it into code somehow.
     
  4. keepthachange

    keepthachange

    Joined:
    Oct 15, 2014
    Posts:
    87
    I haven't tried it yet. Just theory atm.

    What I want is a gameobject to set active if another game object has its alpha set to 1.
    And also have the game object not set active if the other gameobject has its alpha set to 0.

    So if gameobject (placeholder)alpha =1 this gameobject setactive = true;
    Else gameobject setactive = false;

    Been awhile so I'm trying my best here guys to describe what I want to achieve.[/QUOTE]
     
    Last edited: Jul 13, 2019
  5. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,769
    Your QUOTE is missing end bracket ].
    You can edit post to fix it.
     
  6. keepthachange

    keepthachange

    Joined:
    Oct 15, 2014
    Posts:
    87
    I have to post thru my mobile and I have fat sausage fingers. My bad story.