I’ve run into a very weird problem and I"m not sure if it is a bug. I have some code to get the vertices of a mesh and modify them and reassign the vertices back to the mesh.
meshRender = gameObject.GetComponent<MeshRenderer>();
meshFilter = gameObject.GetComponent<MeshFilter>();
mesh = gameObject.GetComponent<MeshFilter>().mesh;
for (int i =0; i < 4; i++)
{
verts _= Camera.main.ScreenToWorldPoint(mesh.vertices*);*_
* }* I know the mesh data is correct but when I try to assign the vertices to the verts array nothing happens! verts remains empty. Any idea why this is the case? thanks
User, you are totally all over the place with mesh.
Please look here carefully. Look at the THREE CLEAR EXAMPLES.
it will show you exactly what to do.
For the record … Never, ever call mesh.vertices inside a loop - it makes a copy each time
But beyond that, what you’re doing is sort of totally mixed-up. (The idea of moving them from screen to world points is very not right!)
I encourage you to leave aside mesh for now until you get going. It could be that using simple GUI textures could help you. Forget about mesh and read up on them!
As a rule there is absolutely no reason, ever, to touch mesh in Unity. It is utterly irrelevant unless you are doing extremely advanced realtime creation of objects etc. For the problem of “bringing up sprites” on the screen you certainly don’t need to know or touch mesh in anyway, at all!
Hope it helps. Be sure to TICK (tick icon in a circle under the thumbs) any useful answers on your various questions.