vovgou / loxodon-framework

An MVVM & Databinding framework that can use C# and Lua to develop games
MIT License
1.86k stars 363 forks source link

Update AddressableUIViewLocator.cs #34

Closed yakirbu closed 1 year ago

yakirbu commented 1 year ago

This update handles the issue where an object is instantiated and is being immediately activated. Now, we make sure that the object will not be seen at the time of the instantiation.

vovgou commented 1 year ago

All codes of the framework are interface-oriented programming, you can reimplement interfaces or override methods according to your own needs, without modifying the source code of the framework to meet your own needs.

Secondly, for your problem, you can set the prefab to an inactive state.

yakirbu commented 1 year ago

All codes of the framework are interface-oriented programming, you can rewrite interfaces or methods according to your own needs, without modifying the source code of the framework to meet your own needs.

Secondly, for your problem, you can set the prefab to an inactive state.

Hi there, I did implement the interface differently, but I was just suggesting a small fix for the default implementation. It's a bug since you are trying to set the GameObject to false after it's already instantiated, at that time the object might already be activated. It causes a flickering. Anyways, you can close the pull request if it you want to leave it that way.

vovgou commented 1 year ago

okay, thank you! I'll test and merge it when I'm free.

vovgou commented 1 year ago

All codes of the framework are interface-oriented programming, you can rewrite interfaces or methods according to your own needs, without modifying the source code of the framework to meet your own needs.

Secondly, for your problem, you can set the prefab to an inactive state.

Hi there, I did implement the interface differently, but I was just suggesting a small fix for the default implementation. It's a bug since you are trying to set the GameObject to false after it's already instantiated, at that time the object might already be activated. It causes a flickering. Anyways, you can close the pull request if it you want to leave it that way.

All codes of the framework are interface-oriented programming, you can rewrite interfaces or methods according to your own needs, without modifying the source code of the framework to meet your own needs.

Secondly, for your problem, you can set the prefab to an inactive state.

Hi there, I did implement the interface differently, but I was just suggesting a small fix for the default implementation. It's a bug since you are trying to set the GameObject to false after it's already instantiated, at that time the object might already be activated. It causes a flickering. Anyways, you can close the pull request if it you want to leave it that way.

I read the source code of Addressaable, I don't recommend using Object.Instantiate method to instantiate a GameObject, it will invalidate the reference count of the created object. So for the issue you mentioned, the best solution is to set the GameObject in the prefab to an inactive state