User avatar
stonstad
Topic Author
Posts: 241
Joined: 06 Jun 2016, 18:14
Location: Lesser Magellanic Cloud
Contact:

NoesisWorldUI Repeated Instantiation on Game Object Enable

11 Dec 2023, 21:46

I am noticing that when a game object hierarchy containing a NoesisWorldUI is re-enabled, the associated XAML is reparsed, loaded, constructor invoked, and Initialized and InitializeComponent methods are reinvoked. This seems like a bug -- and I am looking to see how this might be happening by side effect. I am not seeing a similar or corresponding behavior in NoesisView. Can you guys comment on whether this should be happening?
 
User avatar
stonstad
Topic Author
Posts: 241
Joined: 06 Jun 2016, 18:14
Location: Lesser Magellanic Cloud
Contact:

Re: NoesisWorldUI Repeated Instantiation on Game Object Enable

11 Dec 2023, 22:13

Confirmed --
 void OnEnable()
 {
     FindContainer();
     LoadContent();
     AddContent();
 }

 void OnDisable()
 {
     RemoveContent();

     _content = null;
     _transform = null;
     _containerPanel = null;
     _camera = null;
 }
This isn't the correct behavior for Unity. In Unity, disabling a game object within the hierarchy should not mutate state -- or in this case, cause state to be evicted or reloaded. What would be more appropriate here is to just disable the renderer if the game object is disabled. OnDestroy is the Unity event to hook for evicting state.

https://www.noesisengine.com/bugs/view.php?id=2935
 
User avatar
sfernandez
Site Admin
Posts: 2997
Joined: 22 Dec 2011, 19:20

Re: NoesisWorldUI Repeated Instantiation on Game Object Enable

14 Dec 2023, 10:11

Thanks for the ticket, let's continue the discussion there.

Who is online

Users browsing this forum: No registered users and 1 guest