Skip to content
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

Investigate Potential Editor Scene View Bug When Adding Components During Activate #639

Open
ilexp opened this issue Mar 29, 2018 · 3 comments
Labels
Bug It's broken and should be fixed Core Area: Duality runtime or launcher Editor Area: Duality editor or support libraries
Milestone

Comments

@ilexp
Copy link
Member

ilexp commented Mar 29, 2018

Summary

Forum user Kulko reported a potential editor bug where Components added to a GameObject during the Activate call don't show up in the Scene View and overall seem to throw the editor into an inconsistent state.

Before I checked for being in the editor this got automatically run when adding the controller component to the game Object. So with adding one component I automatically added two. However in the scene tree only the second component (InitState) gets displayed and I had to deactivate components and reactivate components in order to see the controller. In the properties Pane both components are shown correctly.

Bonus Bug: I was not able to delete the reference to the InitState from the Controller via the red cross.

Investigate.

How to reproduce

The following code was posted as an example to reproduce this bug:

        public void OnInit(InitContext context)
        {
            if (context == InitContext.Activate)
            {
                ChangeState<InitBattleState>();
            }
        }

        public virtual void ChangeState<T>() where T : State, new()
        {
            CurrentState = GetState<T>();
        }

        public virtual T GetState<T>() where T : State , new()
        {
            T target = GameObj.GetComponent<T>();
            if (target == null)
                target = GameObj.AddComponent<T>();
            return target;
        }
@ilexp ilexp added Bug It's broken and should be fixed Core Area: Duality runtime or launcher Editor Area: Duality editor or support libraries labels Mar 29, 2018
@ilexp ilexp added this to the General milestone Mar 29, 2018
@Barsonax
Copy link
Member

Tried to reproduce this on master but I see both components being added correctly and I can delete the reference.

@ilexp
Copy link
Member Author

ilexp commented Apr 12, 2018

@KulkoBSW Can you clarify the repro case?

@Barsonax
Copy link
Member

Barsonax commented Jul 9, 2018

The current repro code however doesnt seem to reproduce the bug but maybe it will if we have another component that throws a exception during a event like in #658?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It's broken and should be fixed Core Area: Duality runtime or launcher Editor Area: Duality editor or support libraries
Development

No branches or pull requests

2 participants