Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

[SOLVED] Checking if there is no collision

Discussion in 'Scripting' started by ProExCurator, Feb 10, 2020.

  1. ProExCurator

    ProExCurator

    Joined:
    Jan 2, 2020
    Posts:
    87
    I have a problem with script checking if enemy is not colliding with room collision box. It seems like it doesn't update status of collision with object (Enemy).

    What am I doing wrong?

    Code (csharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.UI;
    5.  
    6. public class VCamera : MonoBehaviour
    7. {
    8.    public GameObject virtualCam;
    9.    public bool DoorSpawned = false;
    10.  
    11.    [SerializeField]
    12.    GameObject DoorClosed;
    13.  
    14.    [SerializeField]
    15.    GameObject DoorOpened;
    16.  
    17.    private int collisionCount;
    18.    public Text enemyCollisionText;
    19.  
    20.    void Update()
    21.    {
    22.        if(collisionCount == 0)
    23.        {
    24.            gameObject.GetComponent<SpriteRenderer>().sprite = DoorOpened.GetComponent<SpriteRenderer>().sprite;
    25.            gameObject.GetComponent<BoxCollider2D>().enabled = DoorClosed.GetComponent<BoxCollider2D>().enabled = false;
    26.            gameObject.GetComponent<Renderer>().enabled = DoorClosed.GetComponent<Renderer>().enabled = false;
    27.            enemyCollisionText.text = "ENEMY COLLISION NOT DETECTED";
    28.        }
    29.    }
    30.  
    31.    private void OnTriggerEnter2D(Collider2D other)
    32.    {
    33.        if(other.CompareTag("Player") && !other.isTrigger)
    34.        {
    35.            virtualCam.SetActive(true);
    36.        }
    37.        if(other.tag == "Player" && DoorSpawned == false)
    38.            {
    39.            gameObject.GetComponent<Renderer>().enabled = DoorClosed.GetComponent<Renderer>().enabled = true;
    40.            gameObject.GetComponent<BoxCollider2D>().enabled = DoorClosed.GetComponent<BoxCollider2D>().enabled = true;
    41.            DoorSpawned = true;
    42.            }
    43.        if(other.tag == "Enemy")
    44.        {
    45.            enemyCollisionText.text = "ENEMY COLLISION DETECTED";
    46.            gameObject.GetComponent<SpriteRenderer>().sprite = DoorClosed.GetComponent<SpriteRenderer>().sprite;
    47.            collisionCount = 1;
    48.        }
    49.    }
    50.    private void OnTriggerExit2D(Collider2D other)
    51.    {
    52.        if (other.CompareTag("Player") && !other.isTrigger)
    53.        {
    54.            virtualCam.SetActive(false);
    55.        }
    56.        if(other.tag == "Enemy")
    57.        {
    58.        collisionCount = 0;
    59.        }
    60.    }
    61. }
    62.  
    Help please.
     
    Last edited: Feb 18, 2020
  2. VSMGames

    VSMGames

    Joined:
    Jan 12, 2020
    Posts:
    47
    If the problem is occurring only with enemy then one thing to look into is enemy collider. If that is also set as trigger then it will not register the collision.
     
  3. ProExCurator

    ProExCurator

    Joined:
    Jan 2, 2020
    Posts:
    87


    So I checked it and I disabled Box Collider with "Is Trigger", but script still doesn't see difference :/

    What else might be a problem?
     
  4. VSMGames

    VSMGames

    Joined:
    Jan 12, 2020
    Posts:
    47
    You have 2 boxcolliders on your enemy and one is still a trigger in the picture. Did you uncheck them both as trigger?
     
  5. ProExCurator

    ProExCurator

    Joined:
    Jan 2, 2020
    Posts:
    87
    Yes, I tried every combination
     
  6. Inxentas

    Inxentas

    Joined:
    Jan 15, 2020
    Posts:
    275
    His code is not registering collisions, it is registering triggers. Having these two mixed up is part of his issue.

    The current code is looking for triggers, so it will only find colliders where the box is checked. The code implies it's on some camera and not on the actual room/ enemy that he's trying to collide together, so that might be an issue.

    OP, the OnTrigger and OnCollision group of methods should be called the by object that the collider is on. The Physics engine will then call them whenever a collision or trigger occurs. It might be that these methods are never triggered because you have written the methods in a component called VCamera and your screenshot shows a Polygon collider on it. If that GameObject is indeed the physical room in your game world, then add a Rigidbody to it and turn it's gravity off.
     
    ProExCurator likes this.
  7. VSMGames

    VSMGames

    Joined:
    Jan 12, 2020
    Posts:
    47
    According to the first screenshot the script is attached to a gameobject which has a collider checked as trigger, so the others can't be triggers, because no collision happens when both gameobjects have colliders with isTrigger enabled. I agree that the Rigidbody2D component is missing from the gameobject with collider checked as trigger which might be causing the issue.
     
    ProExCurator likes this.
  8. ProExCurator

    ProExCurator

    Joined:
    Jan 2, 2020
    Posts:
    87
    So I put everything to new GameObject to be sure that there is no other stuff that might be an issue, but unfortunately it didn't help. New Object "RoomCheck" with Rigidbody, BoxCollider2D and Script.

    So it detects that there is collision triggered but doesn't update when there is no more collision...

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.UI;
    5.  
    6. public class RoomCheckScript : MonoBehaviour
    7. {
    8.     public bool DoorSpawned = false;
    9.  
    10.     [SerializeField]
    11.     GameObject DoorClosed;
    12.  
    13.     [SerializeField]
    14.     GameObject DoorOpened;
    15.  
    16.     private int collisionCount;
    17.     public Text enemyCollisionText;
    18.  
    19.     private void OnTriggerEnter2D(Collider2D other)
    20.     {
    21.         if(other.tag == "Player" && DoorSpawned == false)
    22.             {
    23.             gameObject.GetComponent<Renderer>().enabled = DoorClosed.GetComponent<Renderer>().enabled = true;
    24.             gameObject.GetComponent<BoxCollider2D>().enabled = DoorClosed.GetComponent<BoxCollider2D>().enabled = true;
    25.             DoorSpawned = true;
    26.             }
    27.         if(other.tag == "Enemy")
    28.         {
    29.             enemyCollisionText.text = "ENEMY COLLISION DETECTED";
    30.             gameObject.GetComponent<SpriteRenderer>().sprite = DoorClosed.GetComponent<SpriteRenderer>().sprite;
    31.             collisionCount = 1;
    32.         }
    33.     }
    34.  
    35.     private void OnTriggerExit2D(Collider2D other)
    36.     {
    37.         if(other.tag == "Enemy")
    38.         {
    39.         collisionCount = 0;
    40.         }
    41.     }
    42.  
    43.     void Update()
    44.     {
    45.         if(collisionCount == 0)
    46.         {
    47.             gameObject.GetComponent<SpriteRenderer>().sprite = DoorOpened.GetComponent<SpriteRenderer>().sprite;
    48.             gameObject.GetComponent<BoxCollider2D>().enabled = DoorClosed.GetComponent<BoxCollider2D>().enabled = false;
    49.             gameObject.GetComponent<Renderer>().enabled = DoorClosed.GetComponent<Renderer>().enabled = false;
    50.             enemyCollisionText.text = "ENEMY COLLISION NOT DETECTED";
    51.         }
    52.     }
    53. }
    54.  
    When I remove/disable BoxCollider2D it doesn't work at all. Same with Trigger or with no trigger.
     
    Last edited: Feb 18, 2020
  9. VSMGames

    VSMGames

    Joined:
    Jan 12, 2020
    Posts:
    47
    Don't remove boxcollider, it has to be there. Also you have NullReferenceExeption error in you screenshot displayed in the console which might be pointing towards your problem. Your error is most likely caused by the code inside your if statements in the OnTrigger functions. Check out this example from Unity documentation to get a hint how to fix this: https://docs.unity3d.com/ScriptReference/Renderer-enabled.html
     
    Last edited: Feb 11, 2020
    ProExCurator likes this.
  10. ProExCurator

    ProExCurator

    Joined:
    Jan 2, 2020
    Posts:
    87
    Error is not related with this script:
    It was script for another room generator, that I don't use right now.

    RoomSpawner (Script):
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class RoomSpawner : MonoBehaviour
    6. {
    7.     public int openingDirection;
    8.     // 1 --> need bottom door
    9.     // 2 --> need top door
    10.     // 3 --> need left door
    11.     // 4 --> need right door
    12.  
    13.     private RoomTemplates templates;
    14.     private int rand;
    15.     private bool spawned = false;
    16.  
    17.     public float waitTime = 4f;
    18.  
    19.     void Start(){
    20.         Destroy(gameObject, waitTime);
    21.         templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent<RoomTemplates>();
    22.         Invoke("Spawn", 0.1f);
    23.     }
    24.  
    25.     void Spawn(){
    26.         if(spawned == false){
    27.             if(openingDirection == 1){
    28.                 // Need to spawn a room with a BOTTOM door.
    29.                 rand = Random.Range(0, templates.bottomRooms.Length-1);
    30.                 Instantiate(templates.bottomRooms[rand], transform.position, templates.bottomRooms[rand].transform.rotation);
    31.             } else if(openingDirection == 2){
    32.                 // Need to spawn a room with a TOP door.
    33.                 rand = Random.Range(0, templates.topRooms.Length);
    34.                 Instantiate(templates.topRooms[rand], transform.position, templates.topRooms[rand].transform.rotation);
    35.             } else if(openingDirection == 3){
    36.                 // Need to spawn a room with a LEFT door.
    37.                 rand = Random.Range(0, templates.leftRooms.Length);
    38.                 Instantiate(templates.leftRooms[rand], transform.position, templates.leftRooms[rand].transform.rotation);
    39.             } else if(openingDirection == 4){
    40.                 // Need to spawn a room with a RIGHT door.
    41.                 rand = Random.Range(0, templates.rightRooms.Length);
    42.                 Instantiate(templates.rightRooms[rand], transform.position, templates.rightRooms[rand].transform.rotation);
    43.             }
    44.             spawned = true;
    45.         }
    46.     }
    47.  
    48.     void OnTriggerEnter2D(Collider2D other){
    49.         if(other.CompareTag("Spawnpoint")){
    50.             if(other.GetComponent<RoomSpawner>().spawned == false && spawned == false){
    51.                 Instantiate(templates.closedRoom, transform.position, Quaternion.identity);
    52.                 Destroy(gameObject);
    53.             }
    54.             spawned = true;
    55.         }
    56.     }
    57. }
    So this shouldn't be a problem I think.

    Is there something else that might be source of the problem?
     
  11. VSMGames

    VSMGames

    Joined:
    Jan 12, 2020
    Posts:
    47
    So the OnTriggerEnter now works with the enemy gameobject, but the OnTriggerExit doesn't?
     
    ProExCurator likes this.
  12. ProExCurator

    ProExCurator

    Joined:
    Jan 2, 2020
    Posts:
    87
    It kinda looks like that
     
  13. VSMGames

    VSMGames

    Joined:
    Jan 12, 2020
    Posts:
    47
    Based on your video the enemy is destroyed when it is on the trigger. If I'm correct the OnTriggerExit isn't called when you destroy a gameobject on trigger. Someone correct me if I'm wrong.
    Also check that the RoomCheck gameobject isn't moving, because on your last editor screenshot you have a rigidbody2d with dynamic body type attached to it. Which means forces are applied to it.
     
    ProExCurator likes this.
  14. ProExCurator

    ProExCurator

    Joined:
    Jan 2, 2020
    Posts:
    87
    So I think I found out where the problem was, but there is a new one...
    I moved part of script to Enemy's script

    RoomCheckScript:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.UI;
    5. using System;
    6.  
    7. public class RoomCheckScript : MonoBehaviour
    8. {
    9.     public bool DoorSpawned = false;
    10.  
    11.     [SerializeField]
    12.     GameObject DoorClosed;
    13.  
    14.     [SerializeField]
    15.     GameObject DoorOpened;
    16.  
    17.     public static bool collisionCount;
    18.  
    19.     private void OnTriggerEnter2D(Collider2D other)
    20.     {
    21.         if(other.tag == "Player" && DoorSpawned == false)
    22.         {
    23.             gameObject.GetComponent<Renderer>().enabled = DoorClosed.GetComponent<Renderer>().enabled = true;
    24.             gameObject.GetComponent<BoxCollider2D>().enabled = DoorClosed.GetComponent<BoxCollider2D>().enabled = true;
    25.             DoorSpawned = true;
    26.             EnemyController.enemyCount = 0;
    27.         }
    28.         if(other.tag == "Enemy")
    29.         {
    30.             gameObject.GetComponent<SpriteRenderer>().sprite = DoorClosed.GetComponent<SpriteRenderer>().sprite;
    31.             collisionCount = true;
    32.         }
    33.     }
    34.  
    35.     void Update()
    36.     {
    37.         if(collisionCount == false)
    38.         {
    39.             gameObject.GetComponent<Renderer>().enabled = DoorOpened.GetComponent<Renderer>().enabled = true;
    40.             gameObject.GetComponent<BoxCollider2D>().enabled = DoorClosed.GetComponent<BoxCollider2D>().enabled = false;
    41.             gameObject.GetComponent<Renderer>().enabled = DoorClosed.GetComponent<Renderer>().enabled = false;
    42.         }
    43.     }
    44. }
    EnemyController:
    Code (CSharp):
    1. ...
    2. void OnTriggerEnter2D(Collider2D collision)
    3.     {
    4.        if(collision.tag == "RoomC")
    5.        {
    6.        enemyCount++;
    7.        enemyCountText.text = "ENEMY COUNT: " + enemyCount;
    8.  
    9.        }
    10.    }
    11.  
    12.    void OnTriggerExit2D(Collider2D collision)
    13.     {
    14.        if(collision.tag == "RoomC")
    15.        {
    16.        enemyCount--;
    17.        enemyCountText.text = "ENEMY COUNT: " + enemyCount;
    18.        RoomCheckScript.collisionCount = false;
    19.        }
    20.    }
    21. ...
    (THE ENEMY IS VERY SMALL, YOU MAY NOT SEE IT)

    So enemy counting is working now and it see when there is no more collision, but the new error is this:
    So the door is not disabling it's sprite renderer...

    and I don't get it.... Can someone please help?
     
    Last edited: Feb 18, 2020
  15. VSMGames

    VSMGames

    Joined:
    Jan 12, 2020
    Posts:
    47
    In one of my earlier posts I posted a link to Unity documentation which hopefully helps you to solve this. In your if statements you are trying to get components from RoomCheck gameobject which it doesn't have.
     
    ProExCurator likes this.
  16. ProExCurator

    ProExCurator

    Joined:
    Jan 2, 2020
    Posts:
    87
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.UI;
    5. using System;
    6.  
    7. public class RoomCheckScript : MonoBehaviour
    8. {
    9.     public bool DoorSpawned = false;
    10.    
    11.     [SerializeField]
    12.     GameObject DoorClosed;
    13.    
    14.     [SerializeField]
    15.     GameObject DoorOpened;
    16.    
    17.     public Renderer DoorClosedRend;
    18.    
    19.     public static bool collisionCount;
    20.    
    21.     void Start()
    22.     {
    23.         DoorClosedRend = DoorClosed.GetComponent<SpriteRenderer>();
    24.     }
    25.    
    26.     private void OnTriggerEnter2D(Collider2D other)
    27.     {
    28.         if(other.tag == "Player" && DoorSpawned == false)
    29.         {
    30.             DoorClosedRend.enabled = true;
    31.             gameObject.GetComponent<BoxCollider2D>().enabled = DoorClosed.GetComponent<BoxCollider2D>().enabled = true;
    32.             DoorSpawned = true;
    33.             EnemyController.enemyCount = 0;
    34.         }
    35.         if(other.tag == "Enemy")
    36.         {
    37.             collisionCount = true;
    38.         }
    39.     }
    40.  
    41.     void Update()
    42.     {
    43.         if(collisionCount == false)
    44.         {
    45.             DoorClosedRend.enabled = false;
    46.             gameObject.GetComponent<BoxCollider2D>().enabled = DoorClosed.GetComponent<BoxCollider2D>().enabled = false;
    47.             gameObject.GetComponent<Renderer>().enabled = DoorOpened.GetComponent<Renderer>().enabled = true;
    48.         }
    49.     }
    50. }
    I did it like that right now and the whole script stopped working. Error I get is:
    Help please :/
     
  17. VSMGames

    VSMGames

    Joined:
    Jan 12, 2020
    Posts:
    47
    On line 47 you are trying to get a component from RoomCheck which the gameobject doesn't have attached. If your intention is to enable or disable DoorOpened gameobjects sprite renderer then you need to declare a variable for it, get a component and then enable or disable it.
    Also line 46 has probably a similar problem.
     
    ProExCurator likes this.
  18. ProExCurator

    ProExCurator

    Joined:
    Jan 2, 2020
    Posts:
    87
    I see, but on line 45 I did it the right way? By declaring it in void start?

    Code (CSharp):
    1. void Start()
    2.     {
    3.         DoorClosedRend = DoorClosed.GetComponent<SpriteRenderer>();
    4.     }
     
  19. VSMGames

    VSMGames

    Joined:
    Jan 12, 2020
    Posts:
    47
    Looks OK, though I would suggest making it private, if you don't need to access it from anywhere else.
    Code (CSharp):
    1. private SpriteRenderer doorClosedRend;
     
    ProExCurator likes this.
  20. ProExCurator

    ProExCurator

    Joined:
    Jan 2, 2020
    Posts:
    87
    So I did as you said, but it still doesn't work, there is not error but it just doesn't work :(

    I moved OnTrigger to player script to see if there will be difference, but there is no difference :/

    RoomCheckScript:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.UI;
    5. using System;
    6.  
    7. public class RoomCheckScript : MonoBehaviour
    8. {
    9.     private bool DoorSpawned = false;
    10.     public static bool playerInRoom = false;
    11.  
    12.     [SerializeField]
    13.     GameObject DoorClosed;
    14.  
    15.     [SerializeField]
    16.     GameObject DoorOpened;
    17.  
    18.     private SpriteRenderer doorClosedRend;
    19.     private SpriteRenderer doorOpenedRend;
    20.     private BoxCollider2D doorClosedCollider;
    21.  
    22.     public static bool collisionCount;
    23.  
    24.     void Start()
    25.     {
    26.         doorClosedRend = DoorClosed.GetComponent<SpriteRenderer>();
    27.         doorOpenedRend = DoorOpened.GetComponent<SpriteRenderer>();
    28.         doorClosedCollider = DoorOpened.GetComponent<BoxCollider2D>();
    29.     }
    30.  
    31.     private void OnTriggerEnter2D(Collider2D other)
    32.     {
    33.         if(other.tag == "Enemy")
    34.         {
    35.             collisionCount = true;
    36.         }
    37.     }
    38.  
    39.     void FixedUpdate()
    40.     {
    41.         if(playerInRoom == true && DoorSpawned == false)
    42.         {
    43.             doorClosedRend.enabled = true;
    44.             doorClosedCollider.enabled = true;
    45.             DoorSpawned = true;
    46.             EnemyController.enemyCount = 0;
    47.         }
    48.         if(collisionCount == false)
    49.         {
    50.             doorClosedRend.enabled = false;
    51.             doorClosedCollider.enabled = false;
    52.             doorOpenedRend.enabled = true;
    53.         }
    54.     }
    55. }

    Player:

    Code (CSharp):
    1. ...
    2. void OnTriggerEnter2D(Collider2D collision)
    3.     {
    4.         if(collision.tag == "RoomC")
    5.         {
    6.             RoomCheckScript.playerInRoom = true;
    7.         }
    8.     }
    9. ...
    What is wrong??
     
    Last edited: Feb 18, 2020
  21. VSMGames

    VSMGames

    Joined:
    Jan 12, 2020
    Posts:
    47
    You have a bool collisionCount set to true when enemy enters. Is it set to false at some point?
     
    ProExCurator likes this.
  22. ProExCurator

    ProExCurator

    Joined:
    Jan 2, 2020
    Posts:
    87
    Here it is:

    Enemy (script):
    Code (CSharp):
    1. ...
    2. void OnTriggerEnter2D(Collider2D collision)
    3.     {
    4.         if(collision.tag == "RoomC")
    5.         {
    6.         enemyCount++;
    7.         enemyCountText.text = "ENEMY COUNT: " + enemyCount;
    8.         enemyCollisionDetect.text = "ENEMY COLLISION DETECTED";
    9.         }
    10.     }
    11.    
    12.     void OnTriggerExit2D(Collider2D collision)
    13.     {
    14.         if(collision.tag == "RoomC")
    15.         {
    16.         enemyCount--;
    17.         enemyCountText.text = "ENEMY COUNT: " + enemyCount;
    18.         enemyCollisionDetect.text = "ENEMY COLLISION NOT DETECTED";
    19.         RoomCheckScript.collisionCount = false;
    20.         }
    21.     }
    22. ...
     
  23. VSMGames

    VSMGames

    Joined:
    Jan 12, 2020
    Posts:
    47
    Well things to check here:
    • Does the code inside your collisionCount if statement gets called. Use a Debug.Log("Some text") at the bottom of code inside that if statement.
    • Check your door opened gameobject. Make sure it doesn't have a collider, because player will collide with it.
    • Make sure everything is assigned properly in the inspector, because you had a different sprite for the door closed gameobject in the earlier video.
    • Debug.Log the collisionCount bool value, because it is a static variable which might get changed somewhere in the code.
     
    ProExCurator likes this.
  24. ProExCurator

    ProExCurator

    Joined:
    Jan 2, 2020
    Posts:
    87
    I checked collisionCount with Debug.Log, it's working like it should.

    Colliders are off.




    So what else might be a problem here?
     
  25. VSMGames

    VSMGames

    Joined:
    Jan 12, 2020
    Posts:
    47
    Closed door should have box collider 2d enabled when the game starts. Opened door should have both colliders disabled, the box collider and polygon collider which might be blocking the player. Also in your Start() function you are getting a collider component from opened door gameobject. I belive it should be your closed door collider which you want turn off, fix that.
     
    ProExCurator likes this.
  26. ProExCurator

    ProExCurator

    Joined:
    Jan 2, 2020
    Posts:
    87
    I think I see where the problem is. This is executed before Enemy even enters room:


    Code (CSharp):
    1.     void OnTriggerExit2D(Collider2D collision)
    2.     {
    3.         if(collision.tag == "RoomC")
    4.         {
    5.             enemyCount--;
    6.             enemyCountText.text = "ENEMY COUNT: " + enemyCount;
    7.             enemyCollisionDetect.text = "ENEMY COLLISION NOT DETECTED";
    8.             RoomCheckScript.collisionCount = 0;
    9.         }
    10.     }
    How can I make it execute only after Enemy enter room?

    I tried like this, but it doesn't work:
    Code (CSharp):
    1. private static int enemyEnteredRoom = 0;
    2. ...
    3. void OnTriggerEnter2D(Collider2D collision)
    4.     {
    5.         if(collision.tag == "RoomC")
    6.         {
    7.             enemyCount++;
    8.             enemyCountText.text = "ENEMY COUNT: " + enemyCount;
    9.             enemyCollisionDetect.text = "ENEMY COLLISION DETECTED";
    10.             enemyEnteredRoom = 1;
    11.         }
    12.     }
    13.  
    14.     void OnTriggerExit2D(Collider2D collision)
    15.     {
    16.         if(collision.tag == "RoomC" && enemyEnteredRoom == 1)
    17.         {
    18.             enemyCount--;
    19.             enemyCountText.text = "ENEMY COUNT: " + enemyCount;
    20.             enemyCollisionDetect.text = "ENEMY COLLISION NOT DETECTED";
    21.             RoomCheckScript.collisionCount = 0;
    22.         }
    23.     }
    24. ...
    EDIT: OH MY GOD! I DID IT!

    I set collisionCount to 2 at start...
    Code (CSharp):
    1. public static int collisionCount = 2;

    @VSMGames
    thank you so much, you were very helpful!
     
    Last edited: Feb 18, 2020
  27. VSMGames

    VSMGames

    Joined:
    Jan 12, 2020
    Posts:
    47
    Glad you got it to work.
     
    ProExCurator likes this.