|
I have a prefab which I would like to fade out the alpha on without fading out the alpha on all objects with that material. In the documentation it says the material should be cloned once changed but it's doesn't seem to do that in my project. I'm developing for Android, should that make any difference?
(comments are locked)
|
|
renderer.material will instance a material and break any possible batching while renderer.sharedMaterial will not. for your specific case, either it is a material instance and you haven't realized it (check the material on the object during gameplay for the Instance text next to the material name in the Inspector) or your script is not getting inside the "if" statement and thus not creating a material instance.
(comments are locked)
|
|
I found the problem. Both of my objects acted as if clicked because I was using an examplescript that wasn't specific to one object. () Have you got any good example of how to track if an item is "touched". I tried using RaycastHit but the variables "collider" and "rigidbody" is empty in the debugger.,My script is definitely entering the if statement, because it fades out all instances of the prefab. I'm not calling renderer.sharedMaterial, I'm calling renderer.material. After clicking one of my objects both get (Instance) after the material name. Now I'm starting to think that both objects pick up the click (touch).
(comments are locked)
|
|
My bad. I was using an example that wasn't intended for this kind of function. So whenever a Raycast hit an object all my prefabs acted as if clicked. Have you got any examples of clicking/touching objects? I've tried using RaycastHit but the variable collider return null.
(comments are locked)
|
