Added warnings when attaching fails

This commit is contained in:
Pascal Serrarens 2025-08-22 08:58:06 +02:00
parent 222d183086
commit 5c6b226b64

View File

@ -304,18 +304,19 @@ namespace Passer {
if (handle == null) {
// Transform does not have a handle
DebugLog(gameObject.name + ": Attach failed. Object " + transformToAttach.name + " does not have a handle");
Debug.LogWarning(gameObject.name + ": Attach failed. Object " + transformToAttach.name + " does not have a handle");
return false;
}
if (handle.socket != null) {
Debug.LogWarning(gameObject.name + ": Attach failed. Object " + transformToAttach.name + " is already in a socket");
// Handle is already in a socket
return false;
}
if (socketTag != null && socketTag != "" && !transformToAttach.gameObject.CompareTag(socketTag)) {
// Object did not have the right tag
Debug.Log(gameObject.name + ": Attach failed. Object " + transformToAttach + " does not have the right tag"); ;
Debug.LogWarning(gameObject.name + ": Attach failed. Object " + transformToAttach + " does not have the right tag"); ;
return false;
}
@ -323,7 +324,7 @@ namespace Passer {
if (handleRigidbody != rigidbodyToAttach) {
// Object does not have a handle,
// found handle is of child rigidbody
//Debug.Log(gameObject.name + ": Attach failed. Object does not have a handle. Handle is on child Rigidbody.");
Debug.LogWarning(gameObject.name + ": Attach failed. Object does not have a handle. Handle is on child Rigidbody.");
return false;
}
@ -342,7 +343,7 @@ namespace Passer {
DebugLog(this.gameObject.name + " Attach handle " + handle);
if (handle == null) {
// Transform does not have a handle
DebugLog(gameObject.name + ": Attach failed. Transform does not have a handle");
Debug.LogWarning(gameObject.name + ": Attach failed. Transform does not have a handle");
return false;
}
@ -354,7 +355,7 @@ namespace Passer {
if (socketTag != null && socketTag != "" && !handle.gameObject.CompareTag(socketTag)) {
// Object did not have the right tag
Debug.Log(gameObject.name + ": Attach failed. Handle " + handle + " does not have the right tag"); ;
Debug.LogWarning(gameObject.name + ": Attach failed. Handle " + handle + " does not have the right tag"); ;
return false;
}
@ -420,7 +421,7 @@ namespace Passer {
}
protected void AttachTransformParenting(Transform objTransform, Handle handle) {
Debug.Log("AttachTransformParenting: " + objTransform);
DebugLog("AttachTransformParenting: " + objTransform);
attachedTransformParent = objTransform.parent;