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

Script error (TweakScale): OnDestroy() can not take parameters. #124

Closed
7ranceaddic7 opened this issue Jul 9, 2020 · 18 comments
Closed
Assignees
Labels
question Further information is requested
Milestone

Comments

@7ranceaddic7
Copy link

I'm putting this here because it cites TS and TS-APP is just a config AddOn.
It's the only one of it's kind.

[LOG 14:27:46.964] PartLoader: Compiling Part 'AirplanePlus/Parts/Aero/anglewings/hanglel/hanglel'
[LOG 14:27:47.001] EffectList: Created 18 effect types
[ERR 14:27:47.042] Script error (TweakScale): OnDestroy() can not take parameters.

[LOG 14:27:47.101] PartLoader: Part 'AirplanePlus/Parts/Aero/anglewings/hanglel/hanglel' has no database record. Creating.
[LOG 14:27:47.109] DragCubeSystem: Creating drag cubes for part 'hanglel'
[LOG 14:27:47.148] PartLoader: Compiling Part 'AirplanePlus/Parts/Aero/anglewings/hangles/hangles'
[LOG 14:27:47.167] PartLoader: Part 'AirplanePlus/Parts/Aero/anglewings/hangles/hangles' has no database record. Creating.
[LOG 14:27:47.172] DragCubeSystem: Creating drag cubes for part 'hangles'

KSP.log

@Lisias
Copy link

Lisias commented Jul 10, 2020

KSP-hanglel.zip
Dup of the file to archive it with the issue in the case the file on google-drive is deleted.

@Lisias
Copy link

Lisias commented Jul 10, 2020

Weird!

Obviously, OnDestroy doesn't takes any parameter (assuming we are taking Unity, of course!): https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnDestroy.html

A quick look on the KSP API also didn't revealed any OnDestroy with parameters: https://kerbalspaceprogram.com/api/class_game_events.html
Screen Shot 2020-07-10 at 00 49 52

And none of my logs have this entry neither (and I have tons of test beds here).

You log tells me that this weirdness happened immediately after the first Compiling Part, so AirplanePlus probably is just the messenger, not the culprit.

But I installed it anyway on my 1.9.1 test bed to see what I get. I will come back after firing it up.

@Lisias Lisias self-assigned this Jul 10, 2020
@Lisias Lisias added the question Further information is requested label Jul 10, 2020
@Lisias
Copy link

Lisias commented Jul 10, 2020

Oh, well... It's something on AirplanePlus for sure. Now I have it too! :)

[LOG 01:03:14.335] PartLoader: Creating part database
[LOG 01:03:14.338] PartLoader: Compiling Part 'AirplanePlus/Parts/Aero/anglewings/hanglel/hanglel'
[LOG 01:03:14.407] EffectList: Created 15 effect types
[ERR 01:03:14.498] Script error (TweakScale): OnDestroy() can not take parameters.

[ERR 01:03:14.646] ADDON BINDER: Cannot resolve assembly: TestFlightCore, Culture=neutral, PublicKeyToken=null

[ERR 01:03:14.646] ADDON BINDER: Cannot resolve assembly: TestFlightCore, Culture=neutral, PublicKeyToken=null

[LOG 01:03:14.718] PartLoader: Part 'AirplanePlus/Parts/Aero/anglewings/hanglel/hanglel' has no database record. Creating.
[LOG 01:03:14.726] DragCubeSystem: Creating drag cubes for part 'hanglel'

BUT

AirplanePlus's hanglel (file AirplanePlus/Parts/Aero/anglewings/hanglel.cfg) doesn't have any third parties modules, just the Stock one:

        MODULE
        {
                name = ModuleLiftingSurface
                useInternalDragModel = True
                deflectionLiftCoeff = 0.1
                dragAtMaxAoA = 0.12
                dragAtMinAoA = 0.0
        }

So AirplanePlus is, indeed, only a messenger.

But I'm completely at lost on the issue. I removed everything from the test bed except ModuleManager, AirplanePlus and TweakScale - and yet, I have that message above.

And, nope, Module Manager is not a suspect. I'm not using the same MM as you, and I know most of that code pretty well, and I can say for sure that at least the code I'm running is not calling any OnDestroy (with or without arguments). And I reproduced the problem on it nevertheless.

Interesting.

@Lisias
Copy link

Lisias commented Jul 10, 2020

Curiously... On KSP 1.10, I got the message on another part:

``
[LOG 01:31:55.431] PartLoader: Part 'AirplanePlus/Parts/Wheel/sharedgear/x1sidegear/x1sidegear' has no database record. Creating.
[LOG 01:31:55.431] [DragCubeSystem]: Drag cubes not found or cannot be read for part Part. Generating New drag cubes.
[LOG 01:31:55.436] DragCubeSystem: Creating drag cubes for part 'x1sidegear'
[LOG 01:31:55.543] PartLoader: Compiling Part 'Squad/Parts/Aero/HeatShield/HeatShield0/HeatShield0'
[ERR 01:31:55.563] Script error (TweakScale): OnDestroy() can not take parameters.

[ERR 01:31:55.620] ADDON BINDER: Cannot resolve assembly: TestFlightCore, Culture=neutral, PublicKeyToken=null


Again, with a minimal instalment: MM, TweakScale and AirplanePlus.

@Lisias
Copy link

Lisias commented Jul 10, 2020

AirplanePlus is not needed! I just reproduced the behaviour on KSP 1.8.1 without it!

[LOG 01:40:15.466] [ModuleManager] INFO: Post patch ran in 0.065s
[LOG 01:40:15.599] PartLoader: Creating part database
[LOG 01:40:15.602] PartLoader: Compiling Part 'Squad/Parts/Aero/HeatShield/HeatShield0/HeatShield0'
[LOG 01:40:15.652] EffectList: Created 15 effect types
[ERR 01:40:15.733] Script error (TweakScale): OnDestroy() can not take parameters.

Mostly interesting...

@Lisias
Copy link

Lisias commented Jul 10, 2020

Hey... This happened too on KSP 1.7.3 (with AirplanePlus). What changes is when it happens, aparently...

[LOG 01:45:53.428] PartLoader: Part 'AirplanePlus/Parts/Wheel/sharedgear/x1sidegear/x1sidegear' has no database record. Creating.
[LOG 01:45:53.436] DragCubeSystem: Creating drag cubes for part 'x1sidegear'
[LOG 01:45:53.513] PartLoader: Compiling Part 'Squad/Parts/Aero/HeatShield/HeatShield0/HeatShield0'
[ERR 01:45:53.538] Script error (TweakScale): OnDestroy() can not take parameters.

[ERR 01:45:53.576] ADDON BINDER: Cannot resolve assembly: TestFlightCore, Culture=neutral, PublicKeyToken=null

@7ranceaddic7
Copy link
Author

What was the mod list for your stripped-down test on v1.10? 1.91? 1.8?
I'll see if I can duplicate.

@Lisias
Copy link

Lisias commented Jul 10, 2020

And it happened again on 1.4.1 (without AirplanePlus).

[LOG 01:52:05.495] [ModuleManager] INFO: Post patch ran in 0.040s
[LOG 01:52:05.519] PartLoader: Creating part database
[LOG 01:52:05.521] PartLoader: Compiling Part 'Squad/Parts/Aero/HeatShield/HeatShield0/HeatShield0'
[LOG 01:52:05.547] EffectList: Created 14 effect types
[ERR 01:52:05.595] Script error (TweakScale): OnDestroy() can not take parameters.

[ERR 01:52:05.646] ADDON BINDER: Cannot resolve assembly: TestFlightCore, Culture=neutral, PublicKeyToken=null

@Lisias
Copy link

Lisias commented Jul 10, 2020

What was the mod list for your stripped-down test on v1.10? 1.91? 1.8?
I'll see if I can duplicate.

  • Module Manager
  • AirplanePlus (on some, I realised it's only one of the possible messengers)
  • TweakScale (latest)

@Lisias
Copy link

Lisias commented Jul 10, 2020

Most interesting yet... I got it on KSP 1.3.1...

[LOG 01:57:25.771] [ModuleManager] INFO: Post patch ran in 0.051s
[LOG 01:57:25.781] PartLoader: Creating part database
[LOG 01:57:25.782] PartLoader: Compiling Part 'Squad/Parts/Aero/HeatShield/HeatShield0/HeatShield0'
[LOG 01:57:25.798] EffectList: Created 14 effect types
[ERR 01:57:25.834] Script error (TweakScale): OnDestroy() can not take parameters.

@Lisias
Copy link

Lisias commented Jul 10, 2020

Surprisingly... I installed TS 2.3.7 on the 1.3.1 test bed, and the message did show up.

Going up to 1.4.1 again using it.

@Lisias
Copy link

Lisias commented Jul 10, 2020

Yep... TS 2.3.7 on KSP 1.4.1 didn't triggered the OnDestroy ERR neither.

[LOG 02:04:00.570] [ModuleManager] INFO: Post patch ran in 0.117s
[LOG 02:04:00.594] PartLoader: Creating part database
[LOG 02:04:00.596] PartLoader: Compiling Part 'Squad/Parts/Aero/HeatShield/HeatShield0/HeatShield0'
[LOG 02:04:00.619] EffectList: Created 14 effect types
[ERR 02:04:00.696] ADDON BINDER: Cannot resolve assembly: TestFlightCore, Culture=neutral, PublicKeyToken=null

@7ranceaddic7
Copy link
Author

7ranceaddic7 commented Jul 10, 2020

My 1.9.1-TEST is clean.

[LOG 22:07:52.457] [ModuleManager] Post patch ran in 8.122s
[LOG 22:07:52.479] PartLoader: Creating part database
[LOG 22:07:52.481] PartLoader: Compiling Part 'AirplanePlus/Parts/Aero/anglewings/hanglel/hanglel'
[LOG 22:07:52.503] EffectList: Created 15 effect types
************************************************************************

Environment Info
Win32NT 7FFFFFFFFFFFFFFF  Args: KSP_x64.exe -single-instance -mm-dump

Mod DLLs found:
Stock assembly: Assembly-CSharp v0.0.0.0
Hyperspace v1.0.0.0
ModuleManager v4.1.4.0
Firespitter v7.3.7287.12431

Folders and files in GameData:
AirplanePlus
Firespitter
Stock folder: Squad

Stock folder: SquadExpansion

Hyperspace.dll
ModuleManager.4.1.4.dll
ModuleManager.ConfigCache
ModuleManager.ConfigSHA
ModuleManager.Physics
ModuleManager.TechTree

************************************************************************

image

EDIT: HangOn. I had FS installed too.
EDIT2: Nope, Still clean.

@Lisias
Copy link

Lisias commented Jul 10, 2020

RRRIGHT... I installed TweakScale Beta compiled on debug mode on KSP 1.4.1 (the oldest I support by now, and since it also triggered the problem...).

And I got this:

[LOG 02:14:07.799] [ModuleManager] INFO: Calling Scale.ModuleManagerListener.ModuleManagerPostLoad()
[LOG 02:14:07.800] [TweakScale] DETAIL: ModuleManagerPostLoad handled! shouldShowWarnings is True
[LOG 02:14:07.826] [ModuleManager] INFO: Post patch ran in 0.037s
[LOG 02:14:07.847] PartLoader: Creating part database
[LOG 02:14:07.849] PartLoader: Compiling Part 'Squad/Parts/Aero/HeatShield/HeatShield0/HeatShield0'
[LOG 02:14:07.873] EffectList: Created 14 effect types
[ERR 02:14:07.912] Script error (TweakScale): OnDestroy() can not take parameters.

[LOG 02:14:07.923] [TweakScale] TRACE: OnAwake HeatShield0
[LOG 02:14:07.924] [TweakScale] TRACE: OnLoad HeatShield0 True
[LOG 02:14:07.924] [TweakScale] TRACE: SetupPrefab for HeatShield0

I don't have the faintest idea why in hell the OnDestroy (with parameters!!!) would be called even before the OnAwake method of TweakScale.

Pretty weird. I'm coding some tests and will publish my findings in an hour...

@Lisias
Copy link

Lisias commented Jul 10, 2020

I AM A FSCKING IDIOT

Found this on my code:

        private void OnDestroy(StartState state) // <---- JESUS CHRIST! =D
        {
            if (this.wasOnEditorShipModifiedAdded) GameEvents.onEditorShipModified.Remove(this.OnEditorShipModified);
        }

Ok, coding late night without proper sleep time can bite your on the SAS. Twice, as I missed an obvious error like this one. :P

I will compile this, issue a new 2.4.3 version (damn it!) and will get some more sleep. :D

@7ranceaddic7
Copy link
Author

OOOhhh man.

Please get some rest. You need to take care of yourself before you take care of us.

@Lisias
Copy link

Lisias commented Jul 10, 2020

The funny part - besides issuing the error, Unity ended up calling the method - otherwise the Exceptions on the GameEvents.onEditorShipModified would not had stopped. :D

This is what I hate on Unity. I don't mind making mistakes, I mind not fixing them. This kind of error should be a "fatal" one - what Unity shoved on my (unholy) argument list? NULLs? But the argument is not nullable...

Whatever. :) Release time and the bed again. :)

Lisias added a commit that referenced this issue Jul 10, 2020
@Lisias
Copy link

Lisias commented Jul 10, 2020

Fixed on commit 715d0b9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants