-
Notifications
You must be signed in to change notification settings - Fork 37
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
<view>
GameObject is not removed after Restart
#76
Comments
Unity doesn't have a way to create objects but not place them in the scene. Ideally, we could place all newly created objects in In an ideal case, there shouldn't be an error in the React rendering. So I don't want to implement this in a way that would affect performance much. |
I believe you are correct in saying this, but can't you disable the objects to "fake" them not being there?
It might depend on how the canvas is destroyed, but if views are children of a specific canvas and you remove the canvas, I would expect it to remove the children as well, even if it would affect performance or not, because it needs to clean up after itself. |
@Thundernerd Thanks for your suggestions. Normally, when a view is created it is placed under the canvas. But in this case, an error happens before they are placed under the canvas. That is the root cause of this issue. So your second suggestion would not work. Disabling and enabling objects can affect performance, even if it would be minor. Also objects would still be there, so I don't think that is a solution as well. I have some plans to fix this, but haven't started working on it yet. |
I misunderstood the issue first. I can see the issue after trying it again. It may be caused by a bug in React. I reported it here: facebook/react#26518 Let's see what React devs say about it. If it doesn't get fixed in React, I will fix it with a workaround in ReactUnity. |
Applied the workaround in 0.15.2. This is still a bug in React side. But shouldn't be a problem in ReactUnity anymore. |
NOTE: The error, in this case, does not matter, but I will include it at the end because it might provide a hint for debugging.
Every time an error occurs the
<view>
GameObject is not removed from the scene view when restarting. This also is happening when auto restart/hot reload mechanism triggers.On an unrelated note should not it be part of the Canvas view for easier management?
Video.mp4
The view is part of an error
![image](https://user-images.githubusercontent.com/5092066/204590364-ba155dc3-bdd6-48a0-9477-b4cd722f3b0d.png)
The text was updated successfully, but these errors were encountered: