Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
This question was closed Jan 04, 2015 at 07:14 PM by tanoshimi for the following reason:

Duplicate Question

avatar image
0
Question by geobaby · Jan 04, 2015 at 05:04 PM · ontriggerentersetactiveroll a ball

Program control not entering onTriggerEnter()

Hi, i am a beginner in Unity3d, and am learning from the Roll-A-Ball tutorial from the unity website. i have come across a problem here, please do help me..

The probelm is where we set the collectables. the scene contains a plane, 4 walls, a sphere as the player, and 10 cubes rotating which act as collectables. the sphere moves and touches this cube, the cube dissapears.

Sphere (player) has a rigidbody attached to it. Cubes do not have rigidbody, but has IsTrigger enabled, so they act as trigger colliders.

My problem is that the sphere moves through the cubes, but the cube is not being deactivated. the sphere just moves through the cubes. i found that the program control is not entering inside the function onTriggerEnter() because the Debug.Log statement at the beginning of the function is not executing. Help me please :)

 void onTriggerEnter (Collider other)
 {
     Debug.Log ("inside onTriggerEnter");
     if (other.gameObject.tag == "PickUp") 
     {
         Debug.Log ("function enters inside if");
         other.gameObject.SetActive (false);
     }
 }

This code is attached to the script of the sphere (player).

Comment
Add comment · Show 3
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 EvilTak · Jan 04, 2015 at 05:06 PM 0
Share

I think this question should be closed.

avatar image m_pangolin · Jan 04, 2015 at 05:07 PM 0
Share

try OnTriggerEnter ins$$anonymous$$d of onTriggerEnter

avatar image geobaby · Jan 04, 2015 at 05:26 PM 0
Share

Thanks, i got it right; thanks you two.. sorry that i missed such a small mistake.. :D

1 Reply

  • Sort: 
avatar image
0

Answer by geobaby · Jan 04, 2015 at 07:15 PM

OnTriggerEnter() should be used here instead of onTriggerEnter(). Thanks.

Comment
Add comment · 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

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Set Active To Prefab 1 Answer

Strange problem with OnTrigger 0 Answers

Activate / Deactivate objects onTriggerEnter / Exit 2 Answers

SetActive not working. 1 Answer

SetActive(true) does not work on Linux 2 Answers


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