Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Infinite Runner Starter Pack

Discussion in 'Assets and Asset Store' started by opsive, May 23, 2013.

  1. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Using legacy. Yes, done everything like you said, not playing. It only plays if I use the GameObject.FindWithTag and animation.play. Idle and attack animations work, maybe because its in the same gameobject?
     
    Last edited: Jun 28, 2014
  2. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    If that's the case then your raycast isn't hitting the same object that is found with FindWithTag.

    Within your raycast code you have the following

    Code (csharp):
    1.  
    2.             if(hit.rigidbody){
    3.                if(hit.transform.tag == "Object"){
    4.                Debug.Log("Hit");          
    5. //               obstacleObject = obstacleobj.GetComponent<ObstacleObject>();
    6. //               obstacleObject.canAttack = false;
    7. //               obstacleObject.death();
    8.                obstacleobj = GameObject.FindWithTag("Object");
    9.              obstacleobj.animation.Play("Death_AI");
    10.                }
    11.                
    12.              }
    13.  
    You are already doing a comparison to see if the hit object's name is "Object", which I am assuming is the same object as the one found with FindWithTag. If that is the case, then the following will work:

    Code (csharp):
    1.  
    2.             if(hit.rigidbody){
    3.                if(hit.transform.tag == "Object"){
    4.                Debug.Log("Hit");          
    5.                obstacleObject = hit.transform.GetComponent<ObstacleObject>();
    6.              obstacleobj.animation.Play("Death_AI");
    7.                }
    8.              }
    9.  
    I did a search for the obstacleObject declaration and it is defined out of scope within a different if block. You are using it as two different types - ObstacleObject and then with the FindWithTag it is a GameObject. Which do you want? It looks like all you need to do is:

    Code (csharp):
    1.  
    2. hi.transform.animation.Play("Death_AI");
    3.  
     
  3. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Oh, as simple as that, didn't thought of it, now it works fine. Fixed the enemy gets back up problem using, Many thanks again.
    Code (CSharp):
    1. obstacleObject = hit.transform.GetComponent<ObstacleObject>();
    2.            obstacleObject.canAttack = false;
     
    Last edited: Jun 28, 2014
  4. Hardik

    Hardik

    Joined:
    May 26, 2013
    Posts:
    7
    kit is superb,
    i have one question regarding kit
    Can i change character run time in this kit?
     
  5. vatsav-gundigara

    vatsav-gundigara

    Joined:
    Jul 5, 2014
    Posts:
    2
    Did you find any solution for this ???
     
  6. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    @Hardik,

    To change the player while the game is running you'll need to add different character models as a child of the character prefab. When you want to switch the character out you'll then need to disable the current model and enable the new model. When you switch out the models the only problem that I think that you'll have is that the animations won't be playing correctly. Depending on if you are using mecanim or not, the easiest way to fix that would probably be to just add the animator/animation component to the actual model GameObject instead of the parent GameObject. In PlayerController.cs you'll need to make sure the playerAnimation variable is referencing the correct component, which you can do when you switch out the models.

    @vatsav gundigara,

    I never heard back from drillf00t on my questions. Do you have the same problem? Are you getting any errors?
     
  7. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    Version 1.5.4 of the Infinite Runner Starter Pack Pro has been submitted. This is just a bugfix release and you can view the full change list here. As long as there are no major problems, this is the last release that will be supporting Unity 3.5.7.
     
  8. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    Version 1.5.4 has been approved and is now on the Asset Store!
     
  9. tobicreaper

    tobicreaper

    Joined:
    Apr 30, 2013
    Posts:
    69
    Hi Opsive. The pack is running great so far. However there is a small feature that I need to add into the game and I dont know if that can be implemented using this pack. I have a big container as an obstacle. I want that when the player collides with the container from the front it should die BUT when it collides on the side of the container. it should not die, or bump and it should remain on its previous slot on which it was running, not the one that has the container. Thanks
     
  10. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    In order to determine the collision direction you can use InverseTransformPoint.Since triggers do not give collision contact point or normals you have to use some other method. For your purposes something like the following should work well:

    Code (csharp):
    1.  
    2. Vector3 distance = thisTransform.InverseTransformPoint(other.transform.position);
    3. if (distance.x == 0) {
    4.  // front collision
    5. } else {
    6.  // side collision
    7. }
    8.  
    Depending on how the container is positioned you may need to have an offset when comparing against x instead of just zero. This code goes in ObstacleObject:OnTriggerEnter.
     
  11. tobicreaper

    tobicreaper

    Joined:
    Apr 30, 2013
    Posts:
    69
    thanks a lot. I also need to know if I can change the distance between the obstacles or maybe make my jump faster, In my game, I am using moving obstacles only. There is traffic coming towards me,. The player has to jump over the car, but when the next car comes the jump doesnt work on the spot. After a jump has been made there is a very little wait of say about 0.5 seconds before I can make another jump. Is there anything you can help me with. How can I perform the next jump immediately after another? thanks again
     
  12. tobicreaper

    tobicreaper

    Joined:
    Apr 30, 2013
    Posts:
    69
    there is another problem. The moving obstacles dont get deleted/deactivated. My frame rate drops hugely when the moving obstacles appear. also they just keep falling when they have passed the player. Do they get deactivated in the pool? If yes then how can I make them deactivate sooner. The moving obstacles are really decreasing the performance of the game
     
  13. tobicreaper

    tobicreaper

    Joined:
    Apr 30, 2013
    Posts:
    69
    hey opsive. I have two more problems. When I pause the game and select main menu, the menu appears again but in that menu the player just keeps moving, I doesnt stop. Its like the whole game is running only I cant control it and it's in a different camera angle.

    2nd: When I press restart, the scenery arround me disappears for a while, and sometimes one of the scenery keeps moving along with me.

    Sorry for bombing you with so many questions, I hope you will solve all the problems. Thanks A LOT
     
  14. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    No problem -

    For the first part, to spawn more obstacles, all you should need to do is increase the number of "collidable positions" on the platform object. This will allow it to spawn more obstacles. Most of the platforms in the demo scene use a value of 2 or 3.
    For the second part, to allow the character to jump faster, you can modify the "repeated jump delay" field. This field was added in the latest version.

    I just tried the latest version on the Asset Store and they are working on my end. Does your framerate drop when the obstacle appears or it is spawned? I just verified that the obstacles do get deactivated in the pool. The moving obstacle gets deactivated when the platform that it spawned with is deactivated. It does this through the onPlatformDeactivation event. If you want to make this happen sooner then you can modify the MovingObstacleObject with whatever conditions that you want to change to make it deactivate sooner. Have you tried profiling it to see why the framerate is dropping so much?

    For both of these, can you list the steps to reproduce? This is the first time that I am hearing about these issues and I was unable to reproduce it from the version out on the Asset Store.
     
  15. tobicreaper

    tobicreaper

    Joined:
    Apr 30, 2013
    Posts:
    69
    and about the scenery issue, I will just pm you the steps to reproduce it. Thanks
     
  16. tobicreaper

    tobicreaper

    Joined:
    Apr 30, 2013
    Posts:
    69
    sorry about the last issue. I figured out my stupidity after I asked you the question. I was using the same particle effect for both ground collision and obstacle collision. My bad.
     
  17. tobicreaper

    tobicreaper

    Joined:
    Apr 30, 2013
    Posts:
    69
    hI OPSIVE.. I am facing an issue. When I enter the store, and then come out, the magnet power is activated automatically when I play the game, And it stays.. there is now GUI above to show the magnet power duration or anything. Just the magnet effect is there and it stays through the entire game even if I take other power-ups during gameplay.. Kindly help. thanks
     
  18. tobicreaper

    tobicreaper

    Joined:
    Apr 30, 2013
    Posts:
    69
    and this magnet power stays even when I restart the game. So, Once I have entered the store, I get the magnet power untill I close the application and start it again. Please help opsive. Thanks
     
  19. tobicreaper

    tobicreaper

    Joined:
    Apr 30, 2013
    Posts:
    69
    I just noticed that the magnet power that comes from the STORE, deactivates if we collect the coin magnet powerup during the game.. it disappears when the power up coin magnet's time is over. Then there is no magnet effect.
     
  20. abhishek1191

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    we are working a game and using your starter pack.(we already purchased it)
    how to make alley on this pack.
    the turn bothside platform but with 270 rotation.
    like in stampede
    plz help.
     
  21. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    @tobicreaper -

    Good catch. It's an easy fix. On line 180 of PlayerController.cs, move

    Code (csharp):
    1.  
    2.   // make sure the coin magnet trigger is deactivated
    3.   activatePowerUp(PowerUpTypes.CoinMagnet, false);
    4.  
    To line 225, so you'll have:

    Code (csharp):
    1.  
    2.   public void startGame()
    3.   {
    4.     // make sure the coin magnet trigger is deactivated
    5.     activatePowerUp(PowerUpTypes.CoinMagnet, false);
    6. ...
    7.  
    @abhishek1191 -

    Can you explain your question in more detail? You can make a new left turn platform and it will have a 270 degree rotation.
     
    tobicreaper likes this.
  22. harschell

    harschell

    Joined:
    Sep 20, 2012
    Posts:
    18
    Screen Shot 2014-07-16 at 5.36.12 pm.png Screen Shot 2014-07-16 at 5.36.36 pm.png Screen Shot 2014-07-16 at 5.36.47 pm.png Screen Shot 2014-07-16 at 5.36.56 pm.png
    Hi @opsive

    ## Track Generation Issue ( Scenary moving left after each repeatation ) ##

    I've been using the Infinite Runner Starter Pack Pro.
    I am facing an issue over left and right turns. When I use straight and left/right turn track generation works perfectly and when I use straight, left and right track generation it does works good, but the player's centre position moves to left slightly after each iteration and thus at one time goes out of scene.
    When I checked I noticed that scenary of straight track is moving left while passes throough left track and when it passes through right track it comes back to normal ( its correct position ). Its making playing difficult.

    Can you please help me on this issue? Do tell me WHats going wrong?
    Please find below attached screen shots of respective tracks of inspector setting, I hope that might be helpful to you.
     
  23. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    I saw that you sent me an email as well with the same content - I'll just respond here.

    So the platforms are positioned correctly, but when the character tuns it has an offset? As long as the platforms are positioned correctly that really shouldn't happen. Can you post a screenshot of the in game image?

    Especially with that you are saying with the scene objects, the root of the cause has to be some type of object misalignment problem.

    With an in game screenshot I should be able to tell what's going on more.
     
  24. tobicreaper

    tobicreaper

    Joined:
    Apr 30, 2013
    Posts:
    69
    Thankyou so much opsive. It has solved the problem. There is one more issue. When I am playing the game and I pause it. After that when I press "main menu" from the pause menu. the moving things is the moving obstacles and the player keep moving. They dont stop. However the colliders and controls are turned off. Kindly solve this one too. Thanks a lot once again
     
  25. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    The version that I imported from the Asset Store correctly stops the obstacles/player when paused is pressed. In addition, when I go to the main menu from the pause menu everything gets reset like it should. Are you using the latest version?
     
  26. tobicreaper

    tobicreaper

    Joined:
    Apr 30, 2013
    Posts:
    69
    brother I am using 1.5. And I have made too many changes in the game. I tried to update to latest version but after that it there are A LOT of things that I will have to re-do. Please tell me the solution while I am using this version only. Thanks
     
  27. abhishek1191

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    Hi @opsive I just wanted to know that how could I generate an alley path in the game. By alleys I mean the player can see the straight path in front with a small turn into an alley on either sides. Thanks
     
  28. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    @tobicreaper -

    As far as I remember, there hasn't been a problem where the player keeps moving when the game is paused. However, in version 1.5.1 the player controller significantly changed (as I'm sure you saw) so it's possible that there was that problem but I didn't know about it.

    I do remember a fix for the moving obstacles though. Does your MovingObstacleObject.cs version have the following?

    Within MovingObstacleObject:Start:
    Code (csharp):
    1.  
    2. GameManager.instance.onPauseGame += gamePaused;
    3.  
    And at the end of the file:
    Code (csharp):
    1.  
    2.   private void gamePaused(bool paused)
    3.   {
    4.     enabled = !paused;
    5.     thisRigidbody.isKinematic = paused;
    6.    if (obstacleAnimation) {
    7.      if (paused) {
    8.        obstacleAnimation.Stop();
    9.       } else {
    10.        obstacleAnimation.Play();
    11.       }
    12.    }
    13.   }
    14.  
    @abhishek1191 -

    Ah, thanks. Since your player won't actually be running down the alleys all you need to do is model the alley within your scene object. Besides the alley being within the scene's model, the starter pack doesn't even need to know about it.
     
  29. abhishek1191

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    @opsive Thanks for your reply. But I meant to ask a little different question. I have attached screenshot, it will explain my question better. Now in this image as you can see there is a small alley that appears in the right...I want to add the same feature in my game...the game has scene of a city but at some places there appears a small turn. Now how can i generate a platform like this. Thanks and sorry to bother you with the same question again. :)
    Screenshot_2014-07-17-09-10-02 (1).png
     
  30. tobicreaper

    tobicreaper

    Joined:
    Apr 30, 2013
    Posts:
    69
    Hi opsive. Yes, it does have that code
     
  31. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    @abhishek1191 -

    That picture helps a lot. Currently the starter pack doesn't support the straight + turn combo. However, I am currently working on version 1.6 and that is one of the features that I plan to add.

    @tobicreaper -

    Have you made many modifications to the Moving Obstacle Object class? Can you do a diff between the current version and the version that you have in order to determine what is different? Is that gamePaused callback actually being called? That is the block of code that does the actual stopping of the obstacles when the pause button is pressed.
     
  32. tobicreaper

    tobicreaper

    Joined:
    Apr 30, 2013
    Posts:
    69
    hi opsive. No I havent made any changes to the script. And I think that the roblem is not in moving obstacles script. Because if that would have been the case then during the problem. only moving obstacles would have been moving not the player too. In my case the player also keeps running. The whole world is generated as if I was playing the game. Only the colliders , controls and maincamera remain inactive. Rest is as if we are playing the game., The coins also spawn.

    There is one more thing. I just purchased the latest NGUI. I deleted the NGUI forlder from third party inside the project. Then I imported the latest NGUI. Everything is working fine except when the game gets over the game over menu doesnt show. However I can see it appearing in the scene view but not in the game itself. Also if I select main menu and then start the game again and then when I crash and the game gets over, then the game over menu appears and works fine. Only the first time I play the game then the game over menu doesnt appear on game over

    kindly help. Thanks a lot.
     
  33. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    Since you are using an older version with heavy modifications it's very tough to say what the problem is. I do know that I have never received a bug report saying that the entire game didn't pause correctly though. There was a problem specifically with the moving obstacle objects but that was fixed awhile ago. Your best bet is to start debugging at GameManager : pauseGame. That sends an event to the various objects that need to know if the game is paused. In your case I would set a breakpoint within PlayerController:gamePaused because that is what actually stops the player from moving when the game is paused.

    For NGUI, you need to make sure you extract the NGUI 3 assets folder located at /Infinite Runner/Third Party/NGUI 3 Assets.unitypackage. The assets within this package have been changed as NGUI was updated so you'll definitely want to use the latest version of this file.
     
  34. tobicreaper

    tobicreaper

    Joined:
    Apr 30, 2013
    Posts:
    69
    ok thanks for the reply. I will try it and keep you updated.

    About the NGUI I dont really get what you meant by extracting. Can you please explain in a little more detail. I would be really great full if you could tell me the steps I need to do in order to replace the NGUI with the new one, Thanks once again
     
  35. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    The version of the starter pack that is on the Asset Store uses the free version of NGUI (which is NGUI 2). If you want to use NGUI 3, you need to extract the package located at /Infinite Runner/Third Party/NGUI 3 Assets.unitypackage. This then setups the scene again for NGUI 3. Before you extract the files, make sure you first remove the old NGUI version located at /Infinite Runner/Third Party/NGUI. Sometimes you also need to completely restart Unity in order to completely get rid of all of the NGUI errors.
     
  36. tobicreaper

    tobicreaper

    Joined:
    Apr 30, 2013
    Posts:
    69
    Thanks a lot opsive. I was facing a problem because I thought that you have used NGUI 3 in the pack and I couldnt figure out why it is not working. Now its all clear. Hats off to your support man, Thanks a lot once again
     
  37. abhishek1191

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    @opsive
    Thanks for the reply.
    When are you planning to launch the version 1.6 of the pack? If it is going to take a long then please let me know that how can I add this feature myself. Thanks.
     
  38. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    @tobicreaper - Great to hear!

    @abhishek1191 -

    One of the features that will be in version 1.6 is uGUI support which requires Unity 4.6 be released. So it depends on when 4.6 is released. In the meantime, if you PM/email me your invoice number I can send you a early version as soon as I get done implementing the feature. I hope to get to it within the next week or two.
     
  39. abhishek1191

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    Thanks for the reply
    as alley feature is not in this pack i start working on powerups.
    is there an easy way to make jetpack and make player fly.
    to do that i was thinking
    > i make player jump to another platform (on trigger enter)which is above the main platform and invisible and change running animations to fly
     
  40. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    Line 308 of PlayerController:Update applies a gravity if the player is in the air and is not jumping. The best way to make the player fly would be to adjust this value so gravity is not applied. To initially move the player in the air you will first need to decide how to trigger it (a power up?) and then gradually change the y value to the flying position.
     
  41. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Found a bug, e.g. I pause the game, go back to main menu and I click stats, the play count increases by 2. If I go back and press stats again, it increases by 2 again.
     
  42. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    Good catch, the DataManager was being called with GameOver twice because of the pause state. To fix it all you need to do is reset one variable. Within GameManager:backToMainMenu, change:
    Code (csharp):
    1.  
    2.   if (gamePaused) {
    3.     if (onPauseGame != null)
    4.       onPauseGame(false);
    5.     gameOver(GameOverType.Quit, false);
    6.   }
    7.  
    to:
    Code (csharp):
    1.  
    2.   if (gamePaused) {
    3.     if (onPauseGame != null)
    4.       onPauseGame(false);
    5.     gamePaused = false;
    6.     gameOver(GameOverType.Quit, false);
    7.   }
    8.  
    This block of code starts on line 259.
     
  43. abhishek1191

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    Hi @opsive I wanted my player to stumble if he touches any obstacles from the sides.
    But the script which I updated in this doesn't work. Please tell me whats going wrong with it.

    ObstacleObject.cs

    public virtual void OnTriggerEnter(Collider other)


    Vector3 distance = thisTransform.InverseTransformPoint(other.transform.position);
    if(distance.x==0)
    {
    //front collision
    if (other.gameObject.layer == playerLayer && collideWithPlayer) {
    bool collide = true;
    if (canRunOnTop) {
    if (Vector3.Dot(Vector3.up, (other.transform.position - thisTransform.position)) > 0) {
    collide = false;
    boxCollider.isTrigger = false;
    playerAnimation.run();
    }
    }

    if (collide) {
    gameManager.obstacleCollision(this, other.ClosestPointOnBounds(thisTransform.position));
    }
    }
    }
    else{
    //side collision
    //stumble +1
    //change slot off
    //animation
    PlayerController.ycollide=true;
    }



    PlayerController.cs


    public static bool ycollider=false;

    public void changeSlots(bool right)
    {
    if (ycollide==true)
    {
    changeSlots(false);
    ycollide=false;
    }
    else
    {
    SlotPosition targetSlot = (SlotPosition)Mathf.Clamp((int)currentSlotPosition + (right ? 1 : -1), (int)SlotPosition.Left, (int)SlotPosition.Right);

    changeSlots(targetSlot);
    }


    }
     
  44. areszues92

    areszues92

    Joined:
    Dec 16, 2013
    Posts:
    78
    Thanks, fixed.
     
  45. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    Please use "[ code ]" tags when posting code so it is easier to read. What doesn't work? You probably need to check against some threshold instead of just distance.x == 0 because a horizontal distance of 0 will only occur when you directly hit the obstacle head on. Also, instead of setting a static variable you can change the slot position immediately:

    Code (csharp):
    1.  
    2. ...
    3. else{
    4.   //side collision
    5.   //stumble +1
    6.   //change slot off
    7.    //animation
    8.    PlayerController.instance.changeSlots(false);
    9. }
    10.  
    With this setup you don't need to modify the player controller at all.
     
  46. abhishek1191

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    Hi @opsive I want the platforms to to spawn a little slow...right now I see that 5 to 6 platforms spawn at a time...I was thinking of not more than 2 at a time...please help..Thanks
     
  47. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    On the Infinite Object Generator you can adjust the Sqr Horizon to increase or decrease the amount of platforms spawned.

    For everybody else -

    I have been working on version 1.6 of the starter pack. Here's what I am planning on including:
    - Appearance rule to always spawn an object after another object
    - Revive
    - Second set of coin types used for the revive
    - Four way intersection instead of just T turns
    - Notification popup when you complete a mission during the run
    - uGUI support

    Out of this list, I have the first three items done and should have the next two done within a week or two. I am still debating if I want to hold off the release for uGUI support or just go ahead and release it without uGUI support. I will probably just go ahead and submit it when I get done and uGUI support will be in 1.6.1
     
  48. abhishek1191

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    Hi @opsive Thanks for the reply. That sqr horizon adjustment worked flawless. I have another question. I want my character to go through a tunnel and at that time I want the camera to follow the character closely into tunnel and when the character comes out of it the camera should go back to the original position.
    What are my options of doing this?
    Thanks.
     
  49. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,645
    Similar to the turn trigger, you should create a trigger that spans the length of the tunnel. When you enter that trigger the camera changes to the tunnel position, and when you leave that trigger it changes back to the original position. You'll need to add a 'tunnel position' to the Camera Controller.
     
  50. hluper

    hluper

    Joined:
    Jun 25, 2013
    Posts:
    16
    We can't find the character panel in the GUI Manger. We are following your tutorial on using your own assets. Have you changed it with a different name in a new update?