Load a non-gameobject object from an AssetBundle?

So, I wanted to load a behaviour from an asset bundle. For example the behaviour may look like this:

public class SampleBehaviour {
    public float someFloat;

The issue came where I got the following error:

The referenced script on this Behaviour (Game Object '<null>') is missing!

It is only an error, large games like Rust have also faced this issue:
[1]: http://jira.facepunch.com/browse/RUST-1633

Unfortunately no solve has been posted online as the issue is not faced commonly by developers; therefore, I would really appreciate it if anyone knows of a solution to this problem :slight_smile:

Your question makes not much sense. First of all your class is not a Component as it’s not derived from MonoBehaviour. Maybe you ment that, in this case your example is not representative and misleading.

Next AssetBundes can not contain scripts. AssetBundles can only contain serialized Assets. That means all scripts need to be in the actual application. There is a way to dynamically load assemblies, however that is not supported by all platforms and you need to compile those assemblies yourself. It’s important to load the assemblies before you load any AssetBundle which might contain a serialized object (as prefab or inside a scene) that has a script attached that is located in those assemblies.

If you need any further help you have to be more precise. Since you got an error there has to be some code involved that produced that error. Without knowing what you actually did we can’t tell you what you did wrong.