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

I created a prefab with an obisolver and I exported it to another project. In a script in the project I want to instantiate a solver with the prefab, not creating it by script, just instantiate a solver from the solver prefab I imported...and it failed....unity crashes.


I make some tests since yesterday, if i create a cube and add a script on it....in the script I create a public obisolver. I put the prefab of the solver in the script on the scene and in the start function I just instantiate the solver: ObiSolver.Instantiate(SolverFR, Vector3.zero, Quaternion.identity); Unity freeze....I can't instantiate a solver from a prefab.

I think the only solution is to create by script the solver and the ropes, but it's quite not the best way for me.

thanks a lot in advance if you have any solution for that.

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.
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