HolographicWings / LethalSDK-Unity-Project

Unity Project using Lethal Company SDK
MIT License
43 stars 6 forks source link

Unable to include scripts in AssetBundle #63

Open Wesley-wasnietavailabledusdanmaarzo opened 10 months ago

Wesley-wasnietavailabledusdanmaarzo commented 10 months ago

It seems that regular scripts aren't allowed to be included in the AssetBundle. I thought having the scripts in a dll would resolve it but while loading in the game tells me: Warning: Unity Log] The referenced script (mydllfile.myscript) on this Behaviour is missing! Even though the gameobjects definitely has the correct script attached. Not sure if this is my fault but I'm a bit confused now.

HolographicWings commented 10 months ago

It seems that regular scripts aren't allowed to be included in the AssetBundle. I thought having the scripts in a dll would resolve it but while loading in the game tells me: Warning: Unity Log] The referenced script (mydllfile.myscript) on this Behaviour is missing! Even though the gameobjects definitely has the correct script attached. Not sure if this is my fault but I'm a bit confused now.

this is not allowed, a bundle can't be scanned with any antivirus so it's easy to put malwares in them theres a whitelist of allowed components

Wesley-wasnietavailabledusdanmaarzo commented 10 months ago

That makes sense. So I'm guessing there is no way to have custom stuff happen like.. a box trigger enabling some particles or having a sound play every so many seconds for instance.

HolographicWings commented 10 months ago

That makes sense. So I'm guessing there is no way to have custom stuff happen like.. a box trigger enabling some particles or having a sound play every so many seconds for instance.

i planned to add some scripts to do that, but i never did it, and the mod is in end of support so.. :/

ThisMight commented 9 months ago

Wouldn't it be possible to include these scripts in a separate DLL and run them from there?

HolographicWings commented 9 months ago

Wouldn't it be possible to include these scripts in a separate DLL and run them from there?

Yes, you need to make a DLL, bundles can't store scripts Load this DLL in unity by placing it in a plugins folder

Wesley-wasnietavailabledusdanmaarzo commented 9 months ago

I did try this but whenever I referenced a script from my dll on objects in the prefab, when loaded, the game couldn't find them.

ThisMight commented 9 months ago

I did try this but whenever I referenced a script from my dll on objects in the prefab, when loaded, the game couldn't find them.

Same on that, Little success. I have tried using a bepinex plugin to add the dll via bepinex, but it still couldn't find the reference. won't stop me from trying to figure it out lol.

My theory would be having it added as a component using an auxilary help plugin is one of the ways to do it, but depending on what you're trying to acomplish, this method might either be unmanagable or just unperformant.

HolographicWings commented 9 months ago

Does your bepinex plugins was loading before lethal Expansion?

ThisMight commented 9 months ago

Does your bepinex plugins was loading before lethal Expansion?

Nope, it seems lethalSDK has priority over the plugin, and I lack the knowledge on how to increase priority.

HolographicWings commented 9 months ago

Does your bepinex plugins was loading before lethal Expansion?

Nope, it seems lethalSDK has priority over the plugin, and I lack the knowledge on how to increase priority.

Add a dependency for Lethal Expansion in your plugin Look for Bepinex dependency flag

ThisMight commented 9 months ago

Does your bepinex plugins was loading before lethal Expansion?

Nope, it seems lethalSDK has priority over the plugin, and I lack the knowledge on how to increase priority.

Add a dependency for Lethal Expansion in your plugin Look for Bepinex dependency flag

What I'm guessing is doing something along the lines of

 [BepInPlugin(GUID, Name, Version)]
 [BepInDependency("HolographicWings-LethalExpansion-1.3.30", BepInDependency.DependencyFlags.HardDependency)]

On top of the class inheriting BaseUnityPlugin?

HolographicWings commented 9 months ago

Yes but the id of the mod is just LethalExpansion A tip is to check the name of the config file

ThisMight commented 9 months ago

I've tested that, yet still comes out as not being found on the object inside the map,

Using a simple class "ExistanceNotifier"

public class ExistanceNotifier : MonoBehaviour
    {

        [SerializeField] private string message;

        public void Awake()
        {
            Debug.Log(message);
        }
    }

Using the reference

[BepInPlugin(GUID, Name, Version)]
[BepInDependency("LethalExpansion", BepInDependency.DependencyFlags.HardDependency)]

Inside the editor of the moon itself, simple awake checker image

Yet, in the command line, twice: Once, before the game has started and everything is being initialized image And once the moon has loaded. image

So, I'm not sure exactly what the root cause of the missing dependencies could be at this point.

HolographicWings commented 9 months ago

I tried on my side too LethalExpansion need your DLL as dependance, so it will need every DLL of every peoples who make custom script as dependance I will look for an alternative, like Lua scripting

HolographicWings commented 9 months ago

Lua is not made for Unity, it works but i will have to write every unity function which will take me months..