I’ve searched many other similar questions but none of the solutions to those helped me…
The problem is when i use Resources.load(“myResource”); it always returns null.
The code(C#):
public class Fuser : MonoBehaviour {
public Mesh a;
public Mesh b;
public GameObject t;
void Start () {
a = Resources.Load("floor", typeof(Mesh)) as Mesh;
b = Resources.Load("floor") as Mesh;
//a.CombineMeshes(b);
//MeshFilter[] meshFilters = GetComponentsInChildren(MeshFilter);
CombineInstance[] combine = new CombineInstance[2];
//for ( i = 0; i < 2; i++){
combine[0].mesh = a;
combine[0].transform = new Matrix4x4();
combine[0].mesh = b;
Matrix4x4 m = new Matrix4x4();
m.SetTRS(new Vector3(0,2,0), Quaternion.identity, Vector3.up);
combine[0].transform = m;//new Vector3(0,2,0);//a.transform.localToWorldMatrix;
//meshFilters*.gameObject.active = false;*
-
//}*
-
t.GetComponent<MeshFilter>().mesh = new Mesh();*
-
t.GetComponent<MeshFilter>().mesh.CombineMeshes(combine);*
-
//transform.gameObject.active = true;*
-
}*
-
// Update is called once per frame*
-
void Update () {*
-
}*
}
And the project structure:
[6902-sem+título.png|6902]*
I have tried many different ways and names but none seems to work… I don’t know what i am doing wrong…