List
Phone camera doesn't work under Unity
Posted Date: 2019-07-25 14:39     Edited Date: 2019-08-16 0:30     Writer: inactive

Please provide your development details as below;

1. SDK Version: MAXSTARSDK_Unity_4.1.3
2. Development Environment:  Unity 2019.1.0f2 - Android
3. Tracker/Scanner:Samsung Notes 8
4. License Type(Free / Pro-One Time Fee / Pro-Subscription / Enterprise): Free
5. Target Device(Optional):

6. Unity Remote 5 for the Samsung Note 8 phone

Hi there,

I have the a problem if I want to monitor live the object tracking under Unity: no live cam preview, just a black screen.

In the hierachy I double click in Scene Manager on the script ObjectTrackerSample.cs, but I do not see CameraDevice.GetInstance().StartCamera() function (what in a previous post I saw that was supposed to solve the problem). The only script related to the camera is as follows:

Another thing I noticed is that in the camera settings there is no option for Webcam Type:

Please advise me how to get the phone camera to work.

Thank you in advance,

Catalin

Posted Date: 2019-07-26 0:50     Edited Date: 2019-07-26 0:50     Writer: inactive

Hello mitroi.catalin.

Please go into the device's settings and make sure you have camera privileges.

Thank you.

 

Leo

Maxst Support Team

Posted Date: 2019-07-26 6:50     Edited Date: 2019-07-26 6:50     Writer: inactive

Thank you Leo for your answer,

I checked, all the permissions are granted, it must be something else:

Thank you for further indications...

Best regards,

Catalin

 

Posted Date: 2019-07-29 4:33     Edited Date: 2019-07-29 4:33     Writer: inactive

Hello Catalin.

If the Webcam Type is not visible, it means that there is no cam that can be driven. To run it as a Unity editor, try connecting your webcam and running it.

Thank you.

 

Leo

Maxst Support Team

Posted Date: 2019-08-02 0:22     Edited Date: 2019-08-05 14:15     Writer: inactive

Hello Leo,

I tried a lot of things, among which:

- changed the Unity version to 2018.4

- reinstalled Unity Remote 5

- redone the Developer options from scratch

- created a new Unity project using not only Object Tracker Scene, but also Instant Tracker

The only improvement was that I get a black screen, with buttons that react on my Samsung touch screen. But no camera working.

I tried the Object Tracker in other SDK and THE CAMERA WORKS. That brings me to the ideea, that it is not the phone/camera's fault.

What should I do else?

 

Thank you and best regards,

Catalin

Posted Date: 2019-08-02 11:04     Edited Date: 2019-08-02 11:04     Writer: inactive

Hi again,

One more detail:

Now, in the web cam type box appears "Remote Camera 0" as soon as I press play. Before pressing play nothing appears and there is no option to chose from. Is that ok?

Thank you again.

Posted Date: 2019-08-02 18:56     Edited Date: 2019-08-02 18:56     Writer: inactive

Hi there,

I did also some other experiments, perhaps they help you to understand/solve the problem:

1. I tested the same Unity project on a Huawei P10 phone, the problem is exactly the same as for the Samsung Note 8: no camera working, just a black screen with the buttons.

2. I tested a simliar Unity project on a Laptop and I succeeded to have connection to the laptop's built-in web camera, but NEVER to any phone, even after deactivating the built-in laptop camera.

3. I tried also older Unity versions (e.g. 2017.x) --> useless.

4. I updated the Android ADB interface in Device Manager --> useless

5. I updated the Android version to 8.0.0 --> useless

I consider your SDK an excellent one, so I am eager to be able to use it, therefore I spent already several days to experiment different scenarios. Unfortunately, I cannot use the essential thing for each and every AR application: the device camera.

It is very frustrating, but I hope the you can advise me what to do.

Thank you,

Catalin

 

Posted Date: 2019-08-06 1:57     Edited Date: 2019-08-13 0:41     Writer: inactive

Hi. Catalin. 

1. Have you written your own code to run?

2. Are the camera screens black when you run our sample code without modification?

3. Are there two types of phones you've run: Galaxy Note 8 and Huawei P10?

 

Leo

Maxst Support Team

Posted Date: 2019-08-06 6:34     Edited Date: 2019-08-06 6:34     Writer: inactive

Hi Leo,

1. I don't run my own code, it is your sample code. I apply your sample scenes without modifications.

2. Yes, the phone screens are black and only the buttons are visible on the phone screens when I run your sample code, without any modification.

3. Normally I run only Galaxy Note 8. I tried the Huawei P10 only in order to check if there is a problem with my Note 8, but the problem is exactly the same for both phones.

 

Thank you and best regards,

Catalin

Posted Date: 2019-08-07 17:12     Edited Date: 2019-08-07 17:12     Writer: inactive

Hi Leo,

I also tried to Build and Run the project on my Samsung Note 8. It simply doesn't work.

For a sooner answer I will be more than happy, since I cannot start my project without a working device camera. It's been already weeks of trying without any success! It is simply frustrating!

Thank you in advance for a sooner answer.

Catalin

Posted Date: 2019-08-12 0:55     Edited Date: 2019-08-12 0:55     Writer: inactive

Hmm ... that's weird.

We release it after confirming that it works on Galaxy.

So if you changed your build options at build time,

Are you building in a special environment or not?

 

Leo

Maxst Support Team

Posted Date: 2019-08-12 20:08     Edited Date: 2019-08-12 20:09     Writer: inactive

Some PrintScreens with the build options/environment + console during playing:

Hierarchy:

What should I do more?

Thank you,

Catalin

Posted Date: 2019-08-13 6:11     Edited Date: 2019-08-13 6:11     Writer: inactive

...and the console after building (last messages):

Posted Date: 2019-08-13 9:32     Edited Date: 2019-08-13 9:32     Writer: inactive

I ran it in the environment you gave me.

It works fine on my test devices.

You didn't modify any code using our sample code and didn't touch it in setup, right?

You, me and many other users have run the same configuration on the same sample code. But I think it's not you, but I think your setup is something different.

Please remember which setting is different from us. I want to help you too.

 

Well, let's think about it one by one from the beginning.

1. Connect your webcam and run the sample code in Unity Editor.
At this time, a black screen was output. right?

2. You build and run it on your Galaxy Note 8. Again, a black screen was output.

3. You get a black screen when you build and run your Huwai P8.

4. You just ran our sample code without any changes, and you did not change any settings in Unity.

Are the four items I wrote down all right?

 

Leo

Maxst Support Team

Posted Date: 2019-08-13 14:44     Edited Date: 2019-08-13 14:44     Writer: inactive

Hi Leo,

Thank you for your fast reply!!!! I started a new project in UNITY 2019.1.9f1 from scratch and wrote down step by step what I was doing + the result:

1. I connect my Note8 and start Unity Remote 5

2.. Open the Unity project and import MAXTSTARSDK_Unity_413 as it is, no changes, no check or uncheck options

3. Copy Sample Scene "Object Tracker" into the Hierarchy without any modification

4. Change in Player Settings the Identification Package name and in Editor the device to "Any Android Device"

5. Get the licence number (using the same package name and the SDK version 4.1.x) and paste it into the AR Camera Licence Key

6. Switch the platform to Android using for Run device the option "All compatible devices" then SAVE.

7. Press PLAY --> the output on the Note 8 is a black screen, with the "Back" button visible!!!! So the camera does not work in Unity Remote!!

8. Preess Build and Run having selected both Scenes (MaxST Scene + the Original Sample Scene), save the app name. The output on my Note8 is the SkyBox without any button.

9. Rebuild and Run having selected only the MaxST Scene and the camera works in the App launched from the phone.

10. I attach to the ObjectTrackable a simple object created with VisualSLAMTool and some Text with TexhtMeshPro to the anchor points I've created with the object, then Build and Run. The object doesn't seem to be recognized. No Text appears in the Anchor Point.

Conclusions: In Unity Remote Camera doesn't work. In the built application the camera works, but the object recognition doesn't seem to work.

Thank you for further indications,

Catalin

 

 

 

 

Posted Date: 2019-08-13 16:20     Edited Date: 2019-08-13 16:20     Writer: inactive

UPDATE:

By placing e.g. the MaxST cube NOT as a child of the anchor point, but as a child of the ObjectTrackable, the object is recognized and the augmentation appears IN THE BUILT APPLICATION.

Why does the augmentation not appear when it is placed as a child of an anchor point?

So, the only major problem remains the camera not working in the Unity Remote mode, but ONLY in the built app. Which of course makes the life a nightmare.

Thanks and I am looking forward to your feedback,

Catalin

Posted Date: 2019-08-14 0:36     Edited Date: 2019-08-14 0:36     Writer: inactive

Um ... you use Unity Remote?

Isn't the Unity Remote visible on the device as it appears when you play in the Unity Editor?

So you said the camera screen was black when you ran it in Unity Editor instead of running it in Unity Remote?

Is your webcam connected?

 

Leo

Maxst Support Team

Posted Date: 2019-08-14 0:45     Edited Date: 2019-08-14 0:45     Writer: inactive

The argument does not appear when it is below the anchor point. Because we have implemented that. The guide video tells you to move to Object Tracker's child.

If you realize this, does the camera screen work normally?

 

Leo

Maxst Support Team

Posted Date: 2019-08-14 0:47     Edited Date: 2019-08-14 0:49     Writer: inactive

oh my god ... unity remote simply shows the Unity screen on the device. Did you say your webcam is not connected?
Did you say that the screen is black when you press play in Unity Editor?

 

Leo

Maxst Support Team

Posted Date: 2019-08-14 7:14     Edited Date: 2019-08-14 7:14     Writer: inactive

Hi Leo,

From my first post I mentioned that I use Unity Remote 5 installed on my Samsung Note 8 and I mentioned Unity Remote several times in my post, having even print screen of my Unity Remote 5 permissions.

To make it more clear for you, I described 2 cases:

1. REMOTE: My Samsung Note 8 camera is connected to Unity via Unity Remote 5. I press Play in Unity Editor and a black screen appears on Samsung's screen, as well as in Unity Editor --> SO, the camera in Unity Remote does not work, does not show the environment.

2. BUILT APP: Lately in my posts I Built and Run the application. Then I dissconect the Samsung device from computer, I close Unity Remote 5 and I ran the app from my phone. In this case camera works.

This means that for every change in Unity, I have to Build and Run the application in order to see the effects, launching the app from the phone. Which further means a huge waste of time for each Build of the application after each change.

I worked also with another SDK in Unity and the Samsung camera in Unity Remote worked, it was called "Live preview". I could see the changes "live", over Unity Remote and I was not forced to Build and Run the Unity app after every change in order to see that change.

Now I think it is more clear.

The question is: how to get the phone camera working over Unity Remote 5, the so called "live preveiw"?

Thank you,

Catalin

Posted Date: 2019-08-14 9:32     Edited Date: 2019-08-14 9:32     Writer: inactive

Yes. You are right

You wrote Unity remote from scratch. But I thought of running remote on the device.

It's certainly inconvenient to check on the build and device every time there's a fix.

But besides checking on the device, you can immediately see the changes through the webcam. Do you have a webcam?

After modifying the code, if you illuminate the object with your webcam, tracking will work fine. You can check in real time through the game view in the Unity Editor.

I think unity remote simply shows the game view on the device.

Answer me if you have a webcam.

Thank you. 

 

Leo

Maxst Support Team

Posted Date: 2019-08-14 11:45     Edited Date: 2019-08-14 11:45     Writer: inactive

Yes Leo, I checked a WebCam (an older one from Microsoft) and it is true, it works. Thank you. It is a big step forward!!!!

The problem is that the augmentation is very unstable on the WebCam (it flickers and moves) compared to the built app on the phone, where the augmentation is very stable.

Thnx,

Catalin

Posted Date: 2019-08-16 0:30     Edited Date: 2019-08-16 0:30     Writer: inactive

Hello Catalin.

I'm glad that the problem has improved.

What does it flickers and moves mean?

 

Leo

Maxst Support Team