Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Creating rope at runtime looks unprofessional because of coroutines. How to fix?
#1
Hello, really enjoying Obi Rope so far, but have run into a couple of issues. Im in the final steps of releasing my game, and needs to work some of these out before launch.

In my game I have a save system that counts how many ropes were in the room before you left, then when you come back it loads all those ropes back into the room. My problem with this is that the only documentation I found for creating ropes uses coroutines, and this makes spawning all weird. Instead of being instantiated all at once the ropes are spawned one after another, then it takes some time for them to gain the variables that I have given them, such as their length, they also take time to attach the start and end prefabs and be affected by physics. It can be a solid couple of seconds after i start the game until the ropes are done doing their thing, and it looks super weird and un-professional the entire time. 

How can I fix this? Is there a way to create snakes without coroutines?

Here is my code
Code:
   public IEnumerator makinSnakesLoop(int totalSnake){
       for(int x =0; x<totalSnake; x++){
            GameObject gg = Instantiate(snake, Vector3.zero, Quaternion.identity);
            yield return gg.GetComponent<ObiRope>().StartCoroutine(gg.GetComponent<ObiRope>().GeneratePhysicRepresentationForMesh());

            gg.GetComponent<ObiRope>().AddToSolver(null);


               gg.GetComponent<length>().length2 = newController.ss.lengths[x];
               gg.GetComponent<length>().exp = newController.ss.exp[x];
               gg.GetComponent<length>().goal = newController.ss.goals[x];
       }
   }

Thank you.
Reply


Messages In This Thread
Creating rope at runtime looks unprofessional because of coroutines. How to fix? - by yyy-2c2p - 06-05-2019, 06:35 PM