Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 MrSteve2 · Aug 07, 2020 at 09:37 AM · runtimetexturesblack

Why are my textures black at runtime?

Hello all!

I suspect this might be something to do with the shader set up but my script which works happily with other objects is rendering the below image completely black at run time. alt text Displays fine in Scene mode, but at runtime it's completely black. It is a Standard shader because I have a script that accesses the Alpha channel of the Color.

I have seen a few questions that relate to this but they are quite old and haven't helped me solve anything.

As I mentioned ealier this works fine on other object which are Spheres, but this is a plane is that gives anything away??

Anyone know what is wrong,

ring.png (19.5 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 MrSteve2 · Aug 07, 2020 at 09:55 AM 0
Share

Just to add extra confusion, I have another Plane, with the same script on it, same set up but that renders fine.

alt text

this is the script I am using. The code in flashFunction() works for the stop sign and works fine!

The code in the regular update function effects the blue ring and doesn't work!

 public class trailFader : $$anonymous$$onoBehaviour
 {
     public $$anonymous$$aterial my$$anonymous$$aterial;
     public float fadeValue;
     public string objectType;
     public GameObject child;
     public bool fadeDir;
     public bool flashIn;
 
     public void Awake()
     {
         objectType = gameObject.tag;
         my$$anonymous$$aterial = gameObject.GetComponent<Renderer>().material;
         if (transform.childCount != 0)
         {
             child = transform.GetChild(0).gameObject;
             my$$anonymous$$aterial = child.gameObject.GetComponent<Renderer>().material;
         }
     }
 
     public void Update()
     {
         if (objectType == "Untagged")
         {
             var newColor = my$$anonymous$$aterial.color;
             newColor.a -= fadeValue;
             my$$anonymous$$aterial.color = newColor;
             if (newColor.a < 0)
             {
                 Destroy(gameObject);
             }
 
         }
 
         if (flashIn)
         {
             flashFunction();
         }
 
     }
 
     public void flashFunction()
     {
         if (fadeDir)
         {
             var newColor = my$$anonymous$$aterial.color;
             newColor.a += fadeValue*3;
             my$$anonymous$$aterial.color = newColor;
             if (newColor.a > 1)
             {
                 fadeDir = !fadeDir;
             }
         }
 
         if (!fadeDir)
         {
             var newColor = my$$anonymous$$aterial.color;
             newColor.a -= fadeValue/3;
             my$$anonymous$$aterial.color = newColor;
             if (newColor.a < 0)
             {
                 newColor.a = 0;
                 my$$anonymous$$aterial.color = newColor;
                 fadeDir = !fadeDir;
                 flashIn = false;
             }
         }
     }
 
     public void OnCollisionEnter(Collision collision)
     {
         if (collision.gameObject.CompareTag("Player"))
         {
             if (objectType == gameObject.tag)
             {
                 flashIn = true;
                 fadeDir = true;
             }
         }
     }
 }

ring2.png (54.5 kB)

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by MrSteve2 · Aug 07, 2020 at 09:58 AM

Ok 1 last thing and I will keep schtum! I had another script on it that effects the scale. (Its grows basically)

Having disabled that, it renders fine. So now I guess it's a new questions, why does effecting the scale of it, effect how it renders?

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
avatar image
0

Answer by BobyStar · Dec 21, 2021 at 05:21 AM

I am not exactly sure why scale would effect the rendering. It could be a floating point issue with lighting small areas or rendering small meshes.

​

For anyone who encounters this issue try these checks:

​

  • Make sure you are not scaling the object with a Vector2 and that all scale axis's are not 0.

  • Double check the material and texture properties

  • If it's an imported model, change the Scale Factor in the import settings.

​

If all else fails, try using an Unlit Shader.

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

133 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 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 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 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 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 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 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 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

How to change Textures after build the game? 2 Answers

How to load multiple textures and sounds 0 Answers

Dynamic texture resizing or switching between texture sets of different sizes at runtime 2 Answers

Grab Image/texture from MTL file and apply to a game object 1 Answer

How can I merge 2 Normal Maps into a single Normal Map at runtime? 0 Answers


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