Giter Club home page Giter Club logo

Comments (5)

mafiesto4 avatar mafiesto4 commented on July 3, 2024 1

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.

mafiesto4 avatar mafiesto4 commented on July 3, 2024 1

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.

mafiesto4 avatar mafiesto4 commented on July 3, 2024 1

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.

stefnotch avatar stefnotch commented on July 3, 2024

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.
image

from flaxapi.

stefnotch avatar stefnotch commented on July 3, 2024

@mafiesto4 Should I open a new issue or should this issue be re-opened?

from flaxapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.