Skip to content

Commit a182908

Browse files
committed
Fix asteroid issues.
1 parent 8fafb41 commit a182908

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

DynamicTextureLoader/Loader.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ private void Update()
3737
for (; parts != null && i < parts.Count; i++)
3838
{
3939
AvailablePart ap = parts[i];
40-
if (ap.partUrl != null && ap.partUrl != "")
40+
if (ap.partUrl != null && ap.partUrl != "" && ap.TechRequired != "Unresearcheable")
4141
{
4242
Part part = ap.partPrefab;
4343
TextureUnloaderPartModule module = (TextureUnloaderPartModule)part.AddModule(typeof(TextureUnloaderPartModule).Name);
@@ -46,6 +46,10 @@ private void Update()
4646
module.Load(moduleNode);
4747
module.Unload(true);
4848
}
49+
else
50+
{
51+
Log(ap.name + " Not unloaded.");
52+
}
4953
}
5054
partLoadedIndex = i;
5155
}
@@ -96,11 +100,15 @@ private void Start()
96100
{
97101
foreach (AvailablePart ap in PartLoader.LoadedPartsList)
98102
{
99-
if (ap.partUrl != null && ap.partUrl != "")
103+
104+
Part part = ap.partPrefab;
105+
if (part != null)
100106
{
101-
Part part = ap.partPrefab;
102107
TextureUnloaderPartModule module = (TextureUnloaderPartModule)part.FindModuleImplementing<TextureUnloaderPartModule>();
103-
module.Unload(true);
108+
if (module != null)
109+
{
110+
module.Unload(true);
111+
}
104112
}
105113
}
106114
unloaded = true;
67 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)