Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by SuperSparkplug · Nov 06, 2013 at 06:21 AM · transparencyalphatransparent-texture

Controlling an object's transparancy on trigger

In my game, I want my room prefab to turn at least somewhat transparent or even invisible after a condition concerning an object within it is met, after which it instantiates another room.

alt text

I have all my instantiation code working, it's just the transparency that I don't understand. I want to make the previous room transparent so it doesn't get in the way. I don't know exactly how to control this and I keep reading it depends on the material being used. Right now, I'm using a Toon/Lighted material for most of my models. I'm not sure if that material has an alpha channel within it or not. Exactly how would I control the transparency of my overall prefab or individual models within it, preferably the former since doing it one by one may be somewhat time consuming.

screen shot 2013-11-05 at 4.04.17 am.png (200.6 kB)
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image svenskefan · Nov 06, 2013 at 10:15 AM 0
Share

Hi! You need to have a $$anonymous$$aterial that has an alpha property on it. Before trying to do the transparent stuff in code, try it in the inspector using different materials and shaders.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by ZDS Alpha · Nov 06, 2013 at 11:28 AM

Create such a material:

alt text

Handle Transparency:

alt text

Handle Transparency using scripts:

 gameObject.renderer.material.color.a = 0.5;

For more info: http://docs.unity3d.ru/Components/shader-TransDiffuse.html


untitled.jpg (271.9 kB)
untitled.jpg (236.5 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Texture transparency not working as expected 3 Answers

Does the Particle Animator work with transparent shaders? 1 Answer

Different transparency on same texture? 1 Answer

Render part of object with alpha of other object 1 Answer

An Outline like the Editor does in game, with transparency 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges