Author Topic: MissingComponentException errors  (Read 141 times)

fluqe

  • Newbie
  • *
  • Posts: 5
    • View Profile
MissingComponentException errors
« on: February 25, 2021, 04:50:46 AM »
This was with Viewport mode in version 2019.4.20f1 and after updating to 2019.4.21f1.

I was making a large number of country border changes in the map editor (mostly just combining countries, created a few new countries), saved, tested repeatedly, and everything worked, saved project and closed Unity.

When I re-opened Unity later, the viewport is pink, can't see the map and I get repeated errors like this:

Code
MissingComponentException: There is no 'Renderer' attached to the "Viewport" game object, but a script is trying to access it.
You probably need to add a Renderer to the game object "Viewport". Or your script needs to check if the component is attached before using it.
UnityEngine.Renderer.get_sharedMaterial () (at <d29d557b212f474390dc0b17ef6ce0dd>:0)
WorldMapStrategyKit.WMSK.SetupViewport () (at Assets/WorldMapStrategyKit/Scripts/Core/Internal/WMSKPrivViewport.cs:728)

Mesh filter on Viewport object seems to be missing (attached jpg). Also, I can't open some drop-down menus on the WorldMapStrategyKit object.

If I delete the map/viewport and add a new one, some of my border changes from before are still there, while other changes are gone. Edit: Actually they were all saved in high quality mode, I forgot to switch back
« Last Edit: February 26, 2021, 10:25:30 PM by fluqe »

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 6851
    • View Profile
Re: MissingComponentException errors
« Reply #1 on: February 25, 2021, 08:12:05 AM »
The asset doesn't destroy that component so it has been corrupted somehow. Try to remove the viewport and add it again, then close/open the scene again. If the inspector still gives you problems with some drop-down options, please zip and send me your geodata folder.

fluqe

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: MissingComponentException errors
« Reply #2 on: February 26, 2021, 06:01:52 AM »
I had sent you the Geodata folder, but then I tried creating a new WMSK object, and added my Geodata to it, and it is working again. :o

Well, I'll let you know if I find a way to reproduce the issue ;D

fluqe

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: MissingComponentException errors
« Reply #3 on: February 26, 2021, 10:19:41 PM »
I was able to reproduce it in a new project by creating a Viewport & Map with that Geodata then dragging a UI Canvas object into the RenderViewport of WMSK.

Also when I said "some of my changes are gone" I was mistaken, I just forgot to toggle back to high quality borders. All of my changes were still saved in high quality mode which is awesome.
« Last Edit: February 26, 2021, 10:25:03 PM by fluqe »

jksleary

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: MissingComponentException errors
« Reply #4 on: March 11, 2021, 11:00:49 AM »
I have also experienced this issue. using Viewport and displaying the map through a UI panel. When I add a new canvas to the scene e.g. for other UI elements, at runtime the viewport decides to dump its renderer and I also get:
MissingComponentException: There is no 'Renderer' attached to the "Viewport" game object, but a script is trying to access it.
You probably need to add a Renderer to the game object "Viewport". Or your script needs to check if the component is attached before using it.
This happens whether I am trying to parent the Canvas to the one which contains the Mappanel or independently as a separate object.

Also, whenever I try to use the hidden game objects utility it never finds any objects under WMSK. even if the scene is running correctly i.e. before introducing a new canvas and producing the error above. So they must be there but the utility cannot find or display them.