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

UI imporvments of RoadWorldInfoPanel #822

Closed
kianzarrin opened this issue Apr 8, 2020 · 4 comments · Fixed by #839 or #631
Closed

UI imporvments of RoadWorldInfoPanel #822

kianzarrin opened this issue Apr 8, 2020 · 4 comments · Fixed by #839 or #631
Labels
feature A new distinct feature
Milestone

Comments

@kianzarrin
Copy link
Collaborator

kianzarrin commented Apr 8, 2020

see #631 (comment)

When I tried to Hide RoadWorldInfoPanel:

 NullReferenceException: Object reference not set to an instance of an object
  at ColossalFramework.UI.UIComponent.AttachUIComponent (UnityEngine.GameObject go) [0x00000] in <filename unknown>:0 
  at WorldInfoPanel.Start () [0x00000] in <filename unknown>:0 
  at RoadWorldInfoPanel.Start () [0x00000] in <filename unknown>:0 

my code is :

SimulationManager.instance.m_ThreadingWrapper.QueueMainThread(Singleton<RoadWorldInfoPanel>.instance.Hide);

although this code works it causes a null reference exception in every LateUpdate() call after the exception above:

NullReferenceException: Object reference not set to an instance of an object
  at WorldInfoPanel.LateUpdate () [0x00000] in <filename unknown>:0 

 // the exception comes from this line:
 base.componnet.IsVisible is causing problem

I got my code from this base game code.

	public void OnAdjustRoadButton()
	{
		Singleton<InfoManager>.instance.SetCurrentMode(InfoManager.InfoMode.TrafficRoutes, InfoManager.SubInfoMode.WindPower);
		base.Hide();
	}

EDIT:
and the call stack is:

	Assembly-CSharp.dll!RoadWorldInfoPanel.OnAdjustRoadButton() (IL=0x0000)
 	mscorlib.dll!???
 	ColossalManaged.dll!ColossalFramework.UI.UIComponent.OnClick(ColossalFramework.UI.UIMouseEventParameter p) (IL≈0x003C)
 	ColossalManaged.dll!ColossalFramework.UI.UIButton.OnClick(ColossalFramework.UI.UIMouseEventParameter p) (IL≈0x00A9)
 	ColossalManaged.dll!ColossalFramework.UI.UIInput.MouseHandler.ProcessInput(ColossalFramework.UI.IInputTranslator translator, UnityEngine.Ray ray, ColossalFramework.UI.UIComponent component, bool retainFocusSetting) (IL≈0x0325)
 	ColossalManaged.dll!ColossalFramework.UI.UIInput.ProcessMouseInput() (IL≈0x00AB)
 	ColossalManaged.dll!ColossalFramework.UI.UIInput.Update() (IL≈0x0016)

so considering that I queue RoadWorldInfoPanel.Hide to main thread I do not understand why it causes exceptions.

@kianzarrin kianzarrin added feature A new distinct feature triage Awaiting issue categorisation labels Apr 8, 2020
@originalfoo
Copy link
Member

@kianzarrin will this be fixed by #631 or it it something for future work?

@kianzarrin
Copy link
Collaborator Author

Later. I did not manage to fix this

@kianzarrin
Copy link
Collaborator Author

Ofcourse I commented out the hiding code because I don't want exception spam in output log

@kianzarrin
Copy link
Collaborator Author

I fixed the problem. here is how:
#839 (comment)

@originalfoo originalfoo added this to the 11.5.0 milestone Apr 17, 2020
This was linked to pull requests Apr 17, 2020
@originalfoo originalfoo removed the triage Awaiting issue categorisation label Apr 21, 2020
@kianzarrin kianzarrin mentioned this issue May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new distinct feature
Projects
None yet
2 participants