So I have a gameObject(Let's call it XX) and I have created a Prefab of XX that contains a script (the XX prefab has a script component). When I build the AssetBundle and I load XX on a button click the gameObject of XX loads correctly but the script component doesn't come along. Is there a way to load XX with the script component? Thanks!
Asked
Active
Viewed 747 times
1
-
Taking a look at [AssetBundle](https://docs.unity3d.com/Manual/AssetBundlesIntro.html) it is platform-specific non-code Assets. This might help: https://forum.unity.com/threads/missing-scripts-on-loading-scene-asset-bundle.590824/ – nkazz Mar 22 '21 at 12:10
1 Answers
0
The Solution to my question is that you create the asset bundle from your model-object and then through code you AddComponent to this. Something like this: MyClass xx = anObject.AddComponent(typeof(MyClass)) as MyClass;

Kamzel
- 23
- 5