・ I am studying the mechanism such as coroutines.
I created a blank "Cube" and added a script with "Add Component".
・ I wrote a script based on the above Unity official website as "reference".
"Assets \ TestScript.cs (21,19): error CS0619:
'Component.renderer' is obsolete:'Property renderer has been deprecated.
I got an error, so I tried to fix it.
I changed "renderer" to "GetComponent
(There is no error in the corrected one)
However, when I try to move it, it should be "the coroutine gradually makes the Cube transparent", but it does not change at all.
→ I want to correct it so that it gradually becomes transparent. Also, I would like to know the reason why it cannot be done.
Cube does not gradually become transparent when I press "F" on the keyboard.
There are no error messages.
In "C #" of "Unity"
public class TestScript: MonoBehaviour
void Update ()
if (Input.GetKeyDown ("f"))
Start Coroutine ("Fade");
IEnumerator Fade ()
for (float f = 1f;f>= 0;f-= 0.1f)
Color c = GetComponent
c.a = f;
yield return null;
Debug.Log ("Coroutine" + c);
I thought it would be useless if I didn't add the material, so I tried it, but nothing changed.
The values of "f" and "c" changed in Debug.Log (), and it seems that the coroutine was working properly.
Unity: Version2018.4.20f1 Personal
Answer # 1
With the default material,
OpaqueSo even if you reduce the alpha, it will not be transparent.
FadeI think that transparency will be reflected if you change it.
- c# - coroutines executed before unity scene move are not executed
- unity - coroutines don't work
- the position of the image set in layoutgroup of ui in unity changes
- c# - [unity] the color changes when you click and select an object for n seconds
- c # - [unity] i want to know a smart way to detect changes in variables in other gameobjects
- unity material changes
- in the local rotation of unity, when x axis rotation → z axis rotation → x axis rotation, the last x axis rotation changes not o
- unity - items (gems) increase when the scene changes (getint)
- unity - speed changes with pc and mobile
- c # - [unity] fade processing time using coroutines varies
- c # - i want the player to follow the camera (3d)
- c # - determine whether it is an ai or a player, and if you hit an item, stop slowly and restart when the time is over
- c # - the car with wheelcollider does not hit the stage
- c # - maintain current speed with vector3
- c # - navmeshagent value does not change
- c # - i want to rank in a racing game considering the number of laps unity
- c # - i want to slowly rotate the model to a fixed angle when the flag is set, and slowly return it to the original angle when t
- c # - i want to get my position in unity 3d and place an object right behind me
- c # - i'm trying not to pick up an item when i have it, but if i pick up the item again, it can be used twice
- c # - in a game using unity (cities: skylines), the particles turn pink and the generated sphere becomes a rectangle