So if I created a new material from within a script:
private Material material;
void Start ()
{
material = new Material ("shader/shader");
}
Making sure that the only reference to this material is that material variable, if I were to null it:
void Update ()
{
material = null;
}
Does it also destroy the material? I ask this because I know that Unity wraps c++ objects in c#. So null would make the c# object get garbage collected, but does the c++ side get destroyed aswel? Or do you have to use Destroy () to ensure it does?
the script in which this happens has no access to the object anymore nor the rigidbody, you may think they will be collected. But the GO is still in the scene with a rigidbody attached to it.
So, for a null to work, you would have to gather all containers and references and make the separations from there.