Comments (5)
Thanks for the report. I was able to reproduce it but the problem is that in OnDisable
you don't clear the reference to a deleted object and it is left as an invalid reference (object is not null but it does not have a valid pointer to the underlying C++ object).
The proper fix for this would be changing OnDisable
to:
Destroy(ref _container);
Or you can modify the OnEnable
and use this check:
if (!_container) // <- implicit comparision operator that checks if object is not null and has valid C++ object reference
{
...
from flaxapi.
Can you send me a project on Discord? Because I tested with ref
keyword and it worked well. Maybe my reproduction steps were different.
from flaxapi.
Ok I tested your project and I was able to see the issue.
The problem here is not related to the engine but more to the scene objects usage. Because your script always spawns the object in Start
(if no reference is saved). So using this quick fix is actually a proper way of usage.
I was thinking about changing the play-mode enter logic from Serialize Scenes -> OnDisable -> Play
to OnDisable -> Serializes Scenes -> Play
but it would break some stuff and we don't want to modify it now.
To fix this you can also use Actor.HideFlags = HideFlags.DontSave which is a good choise for a temporary run-time only objects.
Or use Actor.GetOrAddChild to don't spawn actor if it's already there.
from flaxapi.
I changed Destroy(_container);
to Destroy(ref _container);
, however, an issue still persists.
If I repeatedly start and stop the game, it will spawn actors, but not remove them.
Here is what it looks like after hitting Play
a few times.
from flaxapi.
@mafiesto4 Should I open a new issue or should this issue be re-opened?
from flaxapi.
Related Issues (20)
- Custom Editor creation HOT 2
- JSON Serializing private field from base class HOT 2
- Flax in WinForms/WP? HOT 1
- Exception in Thread HOT 1
- Launcher XSS HOT 1
- Music Importing into SceneData Folder Crash HOT 4
- UI Control selection outline HOT 1
- mesh.UpdateMesh while the mesh itself is selected
- Cannot Open Sln HOT 3
- Add building instructions
- Plane scaling
- Unable to Attach VS 2019 to Flax Editor .6 HOT 7
- Editing Animation Player Keyframes Causes Awkward Window Location
- Unable to remove keyframes in Animation Player HOT 2
- Dxgi.dll error when launching editor HOT 1
- Quaternion to Euler documentation HOT 1
- CanvasRootControl Default Size HOT 1
- Launcher exits without error after giving Admin Privileges HOT 2
- Editor ignores scale settings of Windows HOT 1
- Crash in Material Graph HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flaxapi.