private bool TryGetValueObject(out object result, Type type = null) { // Initialize out object result = null; // get container from node values SerializableObjectContainer container = _udonNodeData.nodeValues[_nodeValueIndex]; // Null check, failure if (container == null) { return(false); } // Deserialize into result, return failure on null result = container.Deserialize(); // Strings will deserialize as null, that's ok if (type == null || type == typeof(string)) { return(true); } // any other type is not ok to be null else if (result == null) { return(false); } // Success - return true return(type.IsInstanceOfType(result)); }
private bool TryGetValueObject(out object result) { result = null; SerializableObjectContainer container = null; // For Get and Set variable nodes, reach into the actual value of the linked variable if (_udonNodeData.fullName.Contains("et_Variable")) { container = _udonNodeData.nodeValues[1]; } else { container = _udonNodeData.nodeValues[_nodeValueIndex]; } if (container == null) { return(false); } result = container.Deserialize(); if (result == null) { return(false); } return(true); }
private bool TryGetValueObject(out object result) { result = null; SerializableObjectContainer container = null; // For Get and Set variable nodes, reach into the actual value of the linked variable if (_udonNodeData.fullName.Contains("et_Variable")) { string targetVariableUid = (string)_udonNodeData.nodeValues[0].Deserialize(); if (targetVariableUid == null) { return(false); } var data = _udonNodeData.GetGraph().FindNode(targetVariableUid); if (data == null) { return(false); } container = data.nodeValues[0]; } else { container = _udonNodeData.nodeValues[_nodeValueIndex]; } if (container == null) { return(false); } result = container.Deserialize(); if (result == null) { return(false); } return(true); }
private bool TryGetValueObject(out object result) { // Initialize out object result = null; // get container from node values SerializableObjectContainer container = _udonNodeData.nodeValues[_nodeValueIndex]; // Null check, failure if (container == null) { return(false); } // Deserialize into result, return failure on null result = container.Deserialize(); if (result == null) { return(false); } // Success - return true return(true); }