Hey all, I’m trying to figure out if this is a C# error or I have the logic wrong or what. The following snippet of code is returning several errors.
Does this look problematic or is there a parsing error I’m too tired to see?
void WindowFunction (int windowID) {
if(objecttwo != null) && (objectone != null) {
GUILayout.Label (characterSpeech1);
Debug.Log("Message 1");
}
else if(objecttwo == null) && (objectone == null) {
GUILayout.Label (characterSpeech2);
Debug.Log("Message 2");
}
else if(objecttwo != null) && (objectone == null) {
GUILayout.Label (characterSpeech3);
Debug.Log("Message 3");
}
else(objecttwo == null) && (objectone != null) {
GUILayout.Label (characterSpeech4);
Debug.Log("Message 4");
}
}
Returns:
error CS1525: Unexpected symbol `&&’
error CS1519: Unexpected symbol `else’ in class, struct, or interface member declaration
error CS1519: Unexpected symbol `==’ in class, struct, or interface member declaration
error CS1519: Unexpected symbol `==’ in class, struct, or interface member declaration
error CS1519: Unexpected symbol `(’ in class, struct, or interface member declaration
error CS1519: Unexpected symbol `)’ in class, struct, or interface member declaration
error CS1519: Unexpected symbol `(’ in class, struct, or interface member declaration