Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by thegamingnrd · Dec 30, 2015 at 04:39 AM · c#respawndebug.log

Debug.log not working when entering trigger zone.

Hello peoples! I have been having this problem with my development for a while, and didn't consider asking the Unity community about it. So, here is my problem. I have made an object (spikes) that is, at the moment, has a Debug.log function on it. I fixed the box collider to where it should kill the player on collision. I test it, and nothing pops up in the console. Here are the places in the scripts where it has the debug.log.

Script 1:

 using UnityEngine;
 using System.Collections;
 
 public class LevelManager : MonoBehaviour {
 
     public GameObject currentCheckpoint;
 
     private PlayerMovement player;
 
     // Use this for initialization
     void Start () {
         player = FindObjectOfType<PlayerMovement> ();
     
     }
     
     // Update is called once per frame
     void Update () {
     
     }
 
     public void RespawnPlayer() {
         Debug.Log ("Player Respawn");
     }
 
 }

Script 2:

 using UnityEngine;
 using System.Collections;
 
 public class KillPlayer : MonoBehaviour {
 
     public LevelManager levelManager;
 
     // Use this for initialization
     void Start () {
         levelManager = FindObjectOfType<LevelManager>();
     
     }
     
     // Update is called once per frame
     void Update () {
     
     }
 
     void OnTriggerEnter2D(Collider2D other)
     {
         if(other.name == "Player")
         {
             levelManager.RespawnPlayer();
         }
     }
 }
 

If anybody could help me, that would be really appreciated. Thank you.

Comment
Add comment · Show 6
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image A_Li_N · Dec 30, 2015 at 05:53 AM 0
Share

Does your Player object and Spike object have collider on them? Are those colliders set as 'Is Trigger = true'?

avatar image thegamingnrd A_Li_N · Dec 30, 2015 at 06:36 AM 0
Share

$$anonymous$$y player has a Circle Collider 2D, and my spikes have a Box Collider 2D. Only the spikes have Is Trigger = true.

avatar image savlon · Dec 30, 2015 at 10:46 AM 0
Share

Does your Player object have the "Player" tag? Has at least one of these objects have a rigidbody2D attached?

avatar image thegamingnrd savlon · Dec 30, 2015 at 10:54 AM 0
Share

$$anonymous$$y player has the "Player" tag, and has a Rigidbody2D on it.

avatar image savlon · Dec 30, 2015 at 12:00 PM 0
Share

Hmm... Can you post a screenshot of the current settings of your rigidbody2D. have you checked the collision layers to make sure they accept collisions?

avatar image thegamingnrd · Dec 31, 2015 at 12:38 AM 0
Share

alt textHere you go.

capture.png (11.7 kB)

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by hexagonius · Jan 03, 2016 at 10:57 PM

you're comparing the name. Is it's name Player also? Put the debug first in OnTriggerEnter2D to see if THAT even works

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image thegamingnrd · Jan 03, 2016 at 11:20 PM 0
Share

Thank you! That fixed it! I guess I thought it was going to do the debug by tag. A rookie mistake. :)

avatar image hexagonius thegamingnrd · Jan 03, 2016 at 11:27 PM 0
Share

don't really understand what you mean by that, but as long as it works now :)

avatar image thegamingnrd · Jan 04, 2016 at 12:29 AM 0
Share

I renamed my player to "Player". I originally named my player "Player (prototype)"

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

55 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Stop moving Ball after respawn for seconds c# 0 Answers

Debug.Log Only Printing With Variable (Not string) 0 Answers

C# Respawn and Score Problem 1 Answer

How do i put "Wasted!" after respawn? 0 Answers

Need Help with a Level Reloading Script (c#) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges