- Home /
How to call a new instance of a class in C#
Hi,
This seems like a basic question but the answers I'm finding on google are convoluted. There's got to be a simple way to say:
public void FadeLOSInfo()
{
renderer = GetComponent();
Material[] originalMaterials;
Material[] alphaMaterials;
var needFadeOut = true;
}
FadeLOSInfo fadeInfo = new FadeLOSInfo();
Comment
Best Answer
Answer by Loius · Apr 21, 2013 at 06:58 AM
Constructor?
public class FadeLOSInfo() {
public /*nothing goes here*/ FadeLOSInfo() {
// initialize
}
}
fadeInfo = new FadeLOSInfo();
Ah whoops, I was translating a script and didn't notice it was meant to be a class. How embarassing! Thanks.