Skip to content

Commit

Permalink
Fix reward collision
Browse files Browse the repository at this point in the history
  • Loading branch information
Guerra24 committed May 28, 2024
1 parent e21d978 commit 6fc4c3f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,18 @@ private void OnGUI()
if (!hasComponents)
valid = false;

if (rewardAsset.Info != rewardAssetInfo)
{
rewardAsset.Info = rewardAssetInfo;
EditorUtility.SetDirty(rewardAsset);
updatedAssets = true;
}

UnityEditor.Editor.CreateEditor(rewardAssetInfo).OnInspectorGUI();
if (!hasRewardAsset)
GUILayout.Label("Missing RewardAsset component");
if (!hasRigidBody)
GUILayout.Label("Missing RigidBody component");
if (hasComponents)
GUILayout.Label("Reward valid");

if (hasRewardAsset && rewardAsset.Info != rewardAssetInfo)
{
rewardAsset.Info = rewardAssetInfo;
EditorUtility.SetDirty(rewardAsset);
updatedAssets = true;
}
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ private void Start()

private void OnCollisionEnter(Collision collision)
{
if (Info.DisablePhysicsOnCollision)
if (Info.DisablePhysicsOnCollision && transform.parent == null)
{
Rigidbody.isKinematic = true;
Rigidbody.detectCollisions = false;
transform.parent = collision.transform;
}

Expand Down

0 comments on commit 6fc4c3f

Please sign in to comment.