c# - Can I reference a script attached to a prefab that's loaded from an AssetBundle in Unity WebGL? -


i have unity webgl app using assetbundle manager load prefab. it's loading prefab , associated animations, can't reference script attached prefab. i'm not trying include script in asset bundle - it's in base application. have code stripping disabled.

what's confusing me code able reference while running in editor, not when it's running in browser.

my prefab structured this:

  • container gameobject
    • 3d text

myscript defined this:

public class myscript : monobehaviour {   public textmesh text; } 

my code try access script:

var container = instantiate (prefab); var script = container.getcomponent<myscript> (); 

the container gameobject has script component. script references 3d text via public property. when prefab instantiated while in browser, 3d text object renders correctly, script null.

is there i'm doing wrong, or not possible in webgl player?


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -