Hello
I made a very simple code, that simply fetch the mesh and the material on some gameObject, but they return null, despite the gameobjects being in the scene and having said component, what did I forget?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RenderTest : MonoBehaviour {
RenderTexture RT;
public Material mat;
public GameObject g;
Mesh c;
Material m;
private void Awake()
{
RT = new RenderTexture(512, 512, 24);
c = g.GetComponent<Mesh>();
m = this.gameObject.GetComponent<Material>();
}
void Start () {
Debug.Log(c);
SurfaceCanvas.init(RT, mat);
//...
SurfaceCanvas.close();
m.SetTexture("albedo", RT);
}