Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Objects Spawning in Runtime
#1
Hello, i have Div. Problem, In the unity editor works all good but not in the Buildet Game.
i will spawn Trains (Works) have my Spline track gived names Searsch this and set this in the Spline Controller. In the Editor all good und the Final Game is the Splinein the Controller. But the Pos and all is wrong.
Editor this is correct and Useable
http://prntscr.com/rl4cpl

and this in the game Unusable
http://prntscr.com/rl489y

and my Script
http://prntscr.com/rl4dfs

Who is now my Fail?
Reply
#2
Hi,
By looking at your code, I don't see what causes the issue. Could you Log posMiddle, posFront and posBack and see if the values are different between editor and build? I expect it the values to be different. If so, add more logs in the code that is defining those values, you might find what is wrong.
Also, a minor thing that has probably nothing to do with the issue: you assign "Track" to motor[u].Spline, shouldn't you assign the parameter "spline"?
Have a nice day
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#3
Hi
I deleted your post because this is a public forum, and what you posted is something that you might not want to share with the rest of the world. I will take a look at what you sent soon.
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#4
I don't see what causes the issue by looking at your code. The only thing I can do right now is to give you the following advice:
  1. If not already done, save a copy of your work before continuing
  2. Simplify your code by removing anything that would make the train move (like the assignement to Speed in the Update method). Just keep the initial Position assignement, and see if the issue is still there
  3. Try using a fake (hardcoded) data instead of the data in the server, and see if the issue is still there
  4. Try debugging the build
  5. Try removing all unrelated code. Keep a squeleton code that will only position the train, and see if the issue is still there
If at this point you still have the issue, you should have in between your hands a minimal reproduction case. You can send me that and I will take a look at it

good luck
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#5
Good news I Got it Working, Have used ah Other Spline, Have Ah smal Spleep in my Code addet
and now See.
http://prntscr.com/rm6yn6


Code:
     IEnumerator SetPos(CurvySpline spline, float a1, float a2, float a3, int direction)
       {
           yield return new WaitForSeconds(.5f);
           try
           {
               for (int u = 0; u < this.motor.Length; u++)
               {
                   try
                   {
                       this.motor[u].Spline = Track;
                       this.motor[u].Play();
                   }
                   catch(Exception ex)
                   {
                       log.Error("Set Spline: " + ex);
                   }
                   
                   if (direction == 0)
                   {
                       this.motor[u].MovementDirection = FluffyUnderware.Curvy.Controllers.MovementDirection.Forward;
                   }
                   else
                   {
                       this.motor[u].MovementDirection = FluffyUnderware.Curvy.Controllers.MovementDirection.Backward;
                   }
               }
           }
           catch(Exception ex)
           {
               log.Error("Can not Set the Train Correct: " + ex);
           }

           yield return new WaitForSeconds(.5f);
           try
           {
               for (int u = 0; u < this.motor.Length; u++)
               {
                   if (u == 0)
                   {
                       this.motor[0].Position = a1;
                   }
                   else if (u == 1)
                   {
                       this.motor[0].Position = a1;
                       this.motor[1].Position = a3;
                   }
                   else if (u == 2)
                   {
                       this.motor[0].Position = a1;
                       this.motor[1].Position = a2;
                       this.motor[2].Position = a3;
                   }
               }
           }
           catch(Exception ex)
           {
               log.Error("Can not Set the Train Pos: " + ex);
           }
       }
   }

Big Thanks For your Help. Heart
Reply
#6
(03-23-2020, 01:56 PM)_Aka_ Wrote: you assign "Track" to motor[u].Spline, shouldn't you assign the parameter "spline"?

hahaha
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Method of scattering objects along spline joebain 1 3 11-26-2024, 03:20 PM
Last Post: _Aka_
  making objects solid cielpandapie 1 3 10-18-2024, 12:17 AM
Last Post: _Aka_
  Set Volume to the Volume Controller at Runtime pako88 2 14 04-08-2024, 03:26 PM
Last Post: _Aka_
  Avoiding runtime GC allocations on control point position change Ell223 8 18 02-24-2024, 10:43 AM
Last Post: _Aka_

Forum Jump: