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 May 12, 2016 at 02:19 PM by blackshtormx for the following reason:

It's my question and i'd like to close it

avatar image
0
Question by blackshtormx · Dec 01, 2013 at 07:44 AM · collidingsoldier

I have a game...

Please help! :| when I am going to support soldier and colliding to him, THE GUITEXT text IS NOT CHANGING!!! I am sure my code is right! ok thankx for any help :) HEre is script: var targetGuiText : GUIText;

 function Start()
 {
    targetGuiText.text = "Objective: find a support soldier";
 }
 
 function OnCollisionEnter(collision : Collision)
 {
 
     if (collision.gameObject.name == "supportSoldier")
     {
        targetGuiText.text = "Objective complete!";
     }
 }
Comment
Add comment · Show 4
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 MinerJohn · Dec 01, 2013 at 07:50 AM 0
Share

If anyone didn't notice there is more code. It's just above the code block.

avatar image MinerJohn · Dec 01, 2013 at 07:52 AM 0
Share

Just a quick question, you are attaching the script to the player right?

avatar image blackshtormx · Dec 01, 2013 at 09:33 AM 0
Share

yes right.

avatar image Josh707 · Dec 01, 2013 at 12:30 PM 0
Share

If your soldier is using a character controller you might have to use OnControllerColliderHit() rather than OnCollisionEnter()

1 Reply

  • Sort: 
avatar image
0

Answer by tanoshimi · Dec 01, 2013 at 08:16 AM

Is there a rigidbody on at least one of the game objects?

Is there a collider on both of them?

Is the object you're colliding with definitely called "supportSoldier"?

Is the collision being detected at all? If so, what with? i.e. what does this do:

 function OnCollisionEnter(collision : Collision)
 {
     Debug.Log("Collided detected with: " + collision.gameObject.name);

     if (collision.gameObject.name == "supportSoldier")
     {
       targetGuiText.text = "Objective complete!";
     }
 }
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

19 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

Related Questions

spheres not colliding with world 1 Answer

GetComponent() problems 2 Answers

how to change the path of the sdk? 1 Answer

Rotating gameobject not colliding 0 Answers

Rig and animate a model in unity 3d? 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