Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

You are trying to create a MonoBehaviour using the 'new' keyword #1

Open
josebenitezg opened this issue Jun 24, 2021 · 3 comments
Open

Comments

@josebenitezg
Copy link

Hello, everything is going well until this alter show:

You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all
UnityEngine.MonoBehaviour:.ctor()
PoseRig:.ctor() (at Assets/TruckPit/PoseRig.cs:81)
SocketClient:ParseData(String) (at Assets/TruckPit/SocketClient.cs:57)
SocketClient:Update() (at Assets/TruckPit/SocketClient.cs:32)

I have the same version of Unity and all are working even the pose estimation when you play from unity

Do you have any idea what should be wrong?

@teo3n
Copy link
Collaborator

teo3n commented Jun 28, 2021

That specific issue is known, but since it is merely a warning it can hopefully be ignored. The whole visualization pipeline should work correctly anyways.

If you take a look at the code a bit below SocketClient.cs:57 at lines 79 and 87, the C# garbage collector should take care of the unnecessary instance. While creating a new instance of a MonoBehaviour with the use of 'new' is dubious at best, it does work correctly in this particular case.
Admittably the code was written in a bit of a hurry, as the visualizer was not a high-priority part of the whole project.

Does this prevent the code from compiling on your end or is it merely a warning?

@josebenitezg
Copy link
Author

josebenitezg commented Jun 29, 2021

I was able to compile all the code and even when I press play the video stop or play correctly (In Unity) but I cannot see the 3D Pose Estimation
Captura de Pantalla 2021-06-28 a la(s) 23 12 13

@teo3n
Copy link
Collaborator

teo3n commented Jul 13, 2021

If you look at the terminal, "couldn't parse pose" seems to be a bit suspicious. I cannot help but notice you are also using two distinctively different cameras, one with a very wide FOV and the other one with a very narrow one. The cameras should ideally be of the same model (= similar lens distortions and same resolution). If acquiring two similar cameras is impossible, maybe look into camera calibration and undistortion? Especially that fish-eye lensed camera is a bit problematic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants