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 /
avatar image
1
Question by Evaldas · Nov 25, 2015 at 02:33 PM · c#androidraycast

Raycast doesn't work on Android(cardboard VR), but works in editor.

Hi, I'm stuck for three days now and I really need your help guys.

So the problem is that, raycast doesn't work on android(samsung s6) but works in editor(using Unity 5.2.3f1, and tried 5.2.2f1), so I can't solve it myself. Am I missing any option that has to be set? or is my code the problem? It used to work, but I believe I updated Unity and Carboard SDK and Simple code like this doesn't work anymore. I don't think it's problem of cardboard sdk, I tried setup a simple camera to shoot ray at gameobject and still didn't work.

 RaycastHit hit;

 // Update is called once per frame
 void Update () {
     Debug.DrawRay(gameObject.transform.position, gameObject.transform.forward * 10);
     
     Physics.Raycast(gameObject.transform.position, gameObject.transform.forward, out hit);
     if (hit.collider.tag == "target")
     {
         hit.collider.transform.Rotate(0, 90*Time.deltaTime, 0);
     }
 }
Comment
Add comment · Show 2
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 Evaldas · Nov 24, 2015 at 03:32 PM 0
Share

O$$anonymous$$ so it's definetly not a script fault.

I tried making a new project with copied asset and everything worked. Some internal/project issue.

avatar image misher · Jul 09, 2019 at 06:42 AM 0
Share

in Raycast method call there is maxdistance parameter before out hit you are missing

4 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Tom01098 · Nov 25, 2015 at 08:58 PM

There seems to be a bug with Unity, where if the editor is not visible on your computer, and you are running the game on your phone and they are linked, then no graphical changes actually happen on the phone. Maybe that is your issue?

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
avatar image
0

Answer by Evaldas · Nov 27, 2015 at 10:25 AM

Can't really tell mate, It's must be Unity's bug. Don't know what it is, but the bug has something to do with physics, no collisions worked also in Android build. They weren't linked.

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
avatar image
0

Answer by xumxum · Jun 12, 2016 at 07:03 AM

@Evaldas Hello. Same problem. Any luck solving it?

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
avatar image
0

Answer by megatonmedia · Jul 09, 2019 at 04:26 AM

I just ran into into this bug in Unity 2018 and 2019. If you have multiple EventSystem scripts in your scene. It confuses the VR Event system and the whole thing just stops working. It also breaks in the editor after you do an android build and it will stay broken until you reload your scene.

I'm replying to an old issue as this was high in my google search results and there are very few other results. Hopefully this will help a couple of people.

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

8 People are following this question.

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

Related Questions

Multiple Cars not working 1 Answer

Using raycasts to move a game object toward touch point. 0 Answers

Distribute terrain in zones 3 Answers

Things to do to port game made for iOS in Unity to Android? 2 Answers

Unity 3d - connect android to pc via usb 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