Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 /
avatar image
0
Question by DewDrop · Oct 23, 2012 at 08:07 AM · androidcontrollercolliderhit

android version of game shows error

here is my code, which is runs in PC version. now I'm making its android part.but following codes show some error. what may b the reason?

 var hit:ControllerColliderHit;
 function OnControllerColliderHit(hit)
 {
 if(hit.collider.gameObject.tag=="level1")
                 {
 //do something;
 }
 
 }

It shows this error:

 Assets/tornado/scripts/point_monitor.js(27,24): BCE0019: 'collider' is not a member of 'Object'. 

   
Comment
Add comment · Show 5
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 SolidSnake · Oct 23, 2012 at 08:46 AM 0
Share

You will need to be more clear on what is ControllerColliderHit is.. collider is a GameObject component

avatar image DewDrop · Oct 23, 2012 at 08:55 AM 0
Share

thank you SolidSnake. I'm using a character controller. from the following doc "http://docs.unity3d.com/Documentation/ScriptReference/ControllerColliderHit.html" i can understand that it is related to character controller.

which point i should take care.. as long as am a newbie i don't understand were I'm went wrong?

avatar image SolidSnake · Oct 23, 2012 at 09:02 AM 0
Share

I see... seems that Unity thinks hit is of the generic type "Object" try to cast hit.. something like (hit as ControllerColliderHit).collider

avatar image SolidSnake · Oct 23, 2012 at 09:06 AM 0
Share

actually sorry... I noticed that your function decleration is wrong.. it should be :

function OnControllerColliderHit(hit: ControllerColliderHit)

check example:

http://docs.unity3d.com/Documentation/ScriptReference/CharacterController.OnControllerColliderHit.html?from=ControllerColliderHit

avatar image DewDrop · Oct 23, 2012 at 09:08 AM 0
Share

that really works thanks a lot.. SolidSnake. :-)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Loius · Oct 23, 2012 at 12:35 PM

When working with Android and Unity-javascript, you need to include "#pragma strict" at the top of your scripts. Any errors that detects/causes will also show up as errors on the Android device. Pragma strict disables Javascript's lazy-typing, which isn't supported on Android.

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

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

11 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

Related Questions

Facebook SDK 7.2.2 does not work with Unity 5.3.0f4 0 Answers

Audio not working on Android Phone 0 Answers

Unity Android app crashes when activated a few times with Android's SDK's startActivity(intent). 1 Answer

java android plugin worker thread ends up in Unity mainthread 1 Answer

Android framerate increases a little when I put my finger on the screen. What? 0 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