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 /
avatar image
2
Question by asduffo · Mar 24, 2015 at 07:00 PM · androidunity 5mobilewebcamtexture

Cam texture stopped working in Unity 5/Android Lollipop

Hello guys. I'd like to start by saying that i updated almost simoultaneously to unity 5 and my Moto g 2013 to android 5.0.2 so I don't know the exact source of the issue.

Basically i'm remastering my android game to unity 5 and I'm getting some real issues that are getting me mad with a webcamtexture (i use it to scan some qr).

Before this upgrade it worked just fine: i have a script attached to a mesh renderer that shows me what the camera is pointing to like all the applications that uses camera and i could just use it to get all the informations i wanted. But now it suddenly stopped working and i have 0 clue about what the cause could be.

The mesh that used to show the camera results now is just a plain purple quad for the whole time and i keep getting errors like this in the logcat:

 I/Unity   (14652): NullReferenceException: Object reference not set to an instance of an object
 I/Unity   (14652):   at ScanTest.OnDestroy () [0x00000] in <filename unknown>:0     
 I/Unity   (14652):      
 I/Unity   (14652): (Filename:  Line: -1)    
 I/Unity   (14652): 

Love you logcat for being so clear and pointing me to immaginary negative lines of code

And this is the simple script i use (without the qr scanning stuff for making it cleaner but trust me I triple checked and (unfortunately) it doesn't work):

 using UnityEngine;
 using System.Collections;
 
 public class ScanTest : MonoBehaviour
 {
     private WebCamTexture camTexture;
 
     void Start ()
     {
         camTexture = new WebCamTexture();
         camTexture.requestedHeight = Screen.height; // 480;
         camTexture.requestedWidth = Screen.width; //640;
         camTexture.Play();
     }
 
     void Update () {
         camTexture.GetPixels32();
         GetComponent<MeshRenderer>().material.mainTexture = camTexture;
     }
 
     void OnDisable()
     {
         if (camTexture != null)
         {
             camTexture.Pause();
         }
     }
 
     void OnDestroy()
     {
         camTexture.Stop();
         print("the camTexture is not null");
     }
 }
 

After 4 hours of trying without result this makes me so angry! The game is out in the play store. If someone can help me he will get a special thanks in the release notes.

Many thanks and regards.

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 asduffo · Mar 25, 2015 at 02:02 PM 0
Share

Oh c'mon really? Nobody has an hint?

avatar image levis501 · May 27, 2015 at 02:03 AM 0
Share

Two months later... any progress? Can you simply not call camTexture.Stop()?

avatar image asduffo · May 29, 2015 at 02:02 PM 0
Share

It came out that there were a bug on Unity 5 corrected in a patch that after converting the project into unity 5 it removed the mesh component from the gameObject that had to show the camera feedback. Removing the component and adding it again solved the issue.

0 Replies

· Add your reply
  • Sort: 

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

21 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

Related Questions

Why am I getting an [ERROR: Cannot refresh achievement : VALID_BUT_STALE] response when I call PlayGamesPlatform.Instance.IncrementAchievement? 0 Answers

Unity 5 Android Realtime Shadow Problem 1 Answer

How to set mobile control and scale in size in android setting? 1 Answer

How to make Input.GetAxis work on certain area only? 0 Answers

Draw a line from object to indicate power 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