Now if you were meaning Abstract in a non-programming non-technical term, please state as much, lordofduct is right, the class was not marked as abstract. Also please post the actual error(s).
OK maybe I’ve misunderstood the term abstract, if you could make that clearer to me I’d appreciate it.
I’m not getting an error but as I understand it after I press the ‘make it null’ button the class should be set to null, so if I then press the ‘is it null button’ I should not be able to print out the contents variable of the class as their should be no class there it should be null?
I suggest in the GUI call for the make it null button, you put some logging in there like you did previously. For all we know there isn’t a collider on it.
var testClass: TestClass;
class TestClass{
var contents: String = "Hi this class cant be null if you can read me right?";
function TestClass(){
}
}
function OnGUI(){
if(GUILayout.Button("Check if it's null")){
if(testClass == null){
Debug.Log("It's null");
}else{
Debug.Log(testClass.contents);
}
}
if(GUILayout.Button("Make it null")){
Debug.Log("original contents" + testClass.contents);
testClass.contents = "something else";
Debug.Log("new contents: " + testClass.contents);
testClass = null;
Debug.Log("set to null: " + testClass.contents);
}
}
I find this even stranger you can see that it’s set to null on pressing ‘Make it null’ but if you then press the ‘check if its null button’ again it’s clearly no longer null as you can read the contents string, this string has also reset to what was defined in the original class description.
And yes abstract wasn’t the right term to refer to it as, non mono would probably have been better. I still don’t understand however why this class is not remaining as a null reference.