hello
I have a GameObject c/w Renderer component, its color is red
iI want to change its scale on the fly with “localScale” com
the GameObject gets black (no color)
hello
I have a GameObject c/w Renderer component, its color is red
iI want to change its scale on the fly with “localScale” com
the GameObject gets black (no color)
Are you using a standard shader on the renderer’s material, or some other shader? I suggest trying to modify localScale on a cube with a standard material on it, perhaps in an empty scene, to confirm that it works as expected that way. Then try to work out what’s different in your scene that’s making it behave differently.
hello
my object is actually a cube with a standard shader,
I painted an arrow on a cube face
i want to have alwayes the same size of the arrow for any elevation of the camera
so I have something like:
GameObject arrow ; // the cube with the arrow on it
arrow.transform.localScale = new Vector3 (1,0,1)*transform.position.y /100;
transform.position.y is the elevation of the main Camera
I get a square of constant size but black
a stupid mistake,sorry of course:
arrow.transform.localScale = new Vector3 (transform.position.y /100,1,transform.position.y /100);
What are the settings on your camera? Is it a default camera? I just sat up a scene with that code on a default camera above a cube with a standard shader displaying an image on it and it worked fine. If you are using a default camera, have you tried doing this in a different version of unity to confirm it isn’t an issue with the version of unity you’re using?