Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create rope at runtime
#9
(18-12-2019, 12:48 PM)josemendez Wrote: Hi,

Tested what I think you are doing (instantiating a GameObject with a solver component on it), works just fine for me. Actually, instantiating an object and creating it in code is the same thing internally, so there's no reason I can think of that would cause instatiation to crash/freeze.

Make sure the object you're instantiating does not contain itself the instantiation script. That would cause the instantiated object to instantiate itself again in Start() causing an infinite loop, and of course leading to a crash/freeze.

I surely make a mistake but I don't see it...

My script that make unity crashed:
Object prefab = BundleManager.Get3DPrefab("Obi Solver");
ObiSolver SolverFR = GameObject.Instantiate(prefab) as ObiSolver;

with Get3DPrefab:
public static GameObject Get3DPrefab(string name)
    {
        GameObject go = Instance._bundle3D.LoadAsset(name, typeof(GameObject)) as GameObject;
        if (go == null)
            Debug.LogError("Cannot load or find asset " + name + " in 3D bundle");

        return go;
    }

And the prefab I tried to instantiate:
[Image: 191218010105578823.png]

Thanks a lot Jose
Reply


Messages In This Thread
Create rope at runtime - by Kirian - 23-11-2019, 04:26 AM
RE: Create rope at runtime - by jpalz - 25-11-2019, 08:33 PM
RE: Create rope at runtime - by josemendez - 25-11-2019, 11:16 PM
RE: Create rope at runtime - by josemendez - 26-11-2019, 11:46 AM
RE: Create rope at runtime - by Pingosso - 17-12-2019, 05:05 PM
RE: Create rope at runtime - by josemendez - 18-12-2019, 11:36 AM
RE: Create rope at runtime - by Pingosso - 18-12-2019, 12:21 PM
RE: Create rope at runtime - by josemendez - 18-12-2019, 12:48 PM
RE: Create rope at runtime - by Pingosso - 18-12-2019, 12:57 PM
RE: Create rope at runtime - by Pingosso - 18-12-2019, 02:00 PM