Material.opacity is not working


#1

This leaning project is not working.
https://developer.playcanvas.com/en/tutorials/fading-objects-in-and-out/
It is looks like nothing problem but it does not change opacity when I play the Project.

Same issue happen my project.
I need change material.opacity by my project…

Thanks!


#2

It works fine on my computer with Chrome, Firefox, Edge and Internet Explorer.

What Browser are you using?


#3

Thanks for replay.
I tried on Firefox and Chrome.

Please try fork and publish this project?
Maybe you will understand what I said.


#4

I see what you mean. Didn’t work for me either.

In the script they use it says:

WARNING: setParameter() is still a beta feature and may change in the future

Could be, that this feature is not yet usable in the Version we have.


#5

I changed code to

meshInstances[i].material.opacity = alpha;

from

meshInstances[i].setParameter("material_opacity", alpha);

But still not work:(


#6

If you select the material proto_orange, open the opacity tab and set the value to any value but 1, it’ll work.

An optimisation must have been made where a material with opacity of 1 doesn’t check for any further changes in opacity, but if it starts with an opacity value below 1, then changing the value later on will have an effect.

Hope that helps!


#7

Oops!
I had forgot material.update().

I could change opacity.

Thanks for your helps!