Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Infinite Runner Starter Pack

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

  1. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    You don't need to code anything - the ReportScore method is what the starter pack uses when there is a new high score. I just looked at the code again and I misspoke earlier - your leaderboard id should be whatever your bundle id is plus ".score", so "your.bundle.identifier.score". You can change this by changing line 73 of SocialManager (using version 1.6 of the starter pack).
     
  2. jathoo

    jathoo

    Joined:
    Feb 11, 2013
    Posts:
    29
    yap , done thanks :)
     
  3. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    Hi opsive, can you send me this asset in project.zip ?

    I just upgraded unity to the 4.6 and cannot import from the asset store.
    I will pm you the invoice no.
     
  4. abhishek1191

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    Hi @opsive My team is going to start the texturing of the assets we are going to use, please let me know that how many atlases of texture maps can we use and what should be their size without compromising the performance of the game, the game is for iphone and ipads.
     
  5. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    Hi Justin,

    Any idea what is causing the vibrating movement of the mecanim characters? The camera is shaking when using any mecanim character (I noticed it after using our own character, so tested it with the provided characters and the shaking persists). [I'm not on the latest version (using the latest prior to 1.6) though as we are already to far within development so I halted all framework updates until the project is released.]
     
  6. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
  7. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    Indeed, only the camera was vibrating, removing the root motion check did fix the issue. Thnx.
     
  8. abhishek1191

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    hi @opsive i am working on shaders. currently we are using static value of shaders but we want to change the curve of path. so how i can update shader value dynamically. thanks for the help.
     
  9. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    You can use SetVector. For example:
    Code (csharp):
    1. myMaterial.SetVector("_NearCurve", new Vector4(40, 0, 0, 0));
     
  10. abhishek1191

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    Hi @opsive my artist suggests that he can arrange all the assets in
    3 atlases of size 2048*2048 or
    6 atlases of size1024*1024 or
    1 atlas of 2048*2048 and 4 atlases of 1024*1024 size.
    Please suggest me that which one wud be better for the performance of the game.
     
  11. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    Since that isn't as simple of a question as you would think, take a look at this post as well as this one.
     
  12. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    I just replied to your email with my responses since it contains additional questions.

    To summarize:

    swipe down while jumping to slide: Within the Update loop you'll need to apply heavier gravity so the character moves down faster. When the player hits the ground you'll then need place the player in a slide (this can also be done within the Update loop, somewhere around line 270 of PlayerController.cs)

    flying power up: Instead of adding another branch to that if statement, just don't call game over if the fly high power up is active.
     
  13. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    Sure, I should be able to add it to the next bugfix release
    For that take a look at line 597 of PlayerController.cs. There are a lot of conditions which determine if the jump from a trigger should actually trigger a jump, and you should just add your new power up type to that list:
    Code (csharp):
    1.  
    2.   // don't jump if coming from a trigger and auto jump, invincibility/speed increase and God mode are not activated
    3.   if (fromTrigger && !autoJump && !powerUpManager.IsPowerUpActive(PowerUpTypes.Invincibility) && !powerUpManager.IsPowerUpActive(PowerUpTypes.SpeedIncrease)&& !powerUpManager.IsPowerUpActive(PowerUpTypes.FlyHigh) && !gameManager.godMode) {
    4.   return;
    5.   }
    6.  
     
  14. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    As long as you have the jump trigger and your new power up is active then the character should jump when he reaches the trigger. In terms of the next release, version 1.6.1 of the starter pack will probably go out shortly after the new uGUI is officially release, so with Unity 4.6. I have most of the new uGUI code in place for the starter pack, just need to polish a few things.
     
  15. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    Besides an updated GUIManager and associated editor script, the only other file that will be changed is the scene. I will probably just include a new scene that uses uGUI. If you want to transfer it to your current scene you'll just have to copy the GUI objects and the GUIManager component.
     
  16. SiMKiNG

    SiMKiNG

    Joined:
    Dec 2, 2013
    Posts:
    14
    Hi Opsive just wondering if there is anyway to make the same scene appear like 5 times before it randomly changes to the next one??
     
  17. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    There is not a rule that will allow you to specify that, though I have written it down for a future release.

    In the meantime, you have two different options:

    Manually join the five different scenes together and create one SceneObject prefab from that, or
    Create five different prefabs with the same model, and create an appearance rule so each one is forcefully appeared after another. For example, if you have SceneA, for SceneB you would then create an appearance rule that has an appearance probably with "Force Appearance" enabled for SceneA:



    It would be nice if Unity supported nested prefabs because then this situation would be solved.
     
  18. SiMKiNG

    SiMKiNG

    Joined:
    Dec 2, 2013
    Posts:
    14
    Oh ok Thanks heaps man
     
  19. SiMKiNG

    SiMKiNG

    Joined:
    Dec 2, 2013
    Posts:
    14
    Can I also change the camera so that wheni change slots it doesn't move the whole distance horizontally just say half the distance?
     
  20. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    The easiest way is probably to just clamp the position between two values. In CameraController.cs, modify the LateUpdate method to something like:

    Code (csharp):
    1.  
    2. Vector3 relativeTargetPosition = playerTransform.TransformPoint(targetPosition);
    3. relativeTargetPosition.x = Mathf.Clamp(relativeTargetPosition.x, MIN, MAX);
    4. relativeTargetPosition.z = Mathf.Clamp(relativeTargetPosition.z, MIN, MAX);
    5.  
    This on line 106 within version 1.6. I didn't test it but it should at least get you started.
     
  21. SiMKiNG

    SiMKiNG

    Joined:
    Dec 2, 2013
    Posts:
    14
    1. Vector3 relativeTargetPosition = playerTransform.TransformPoint(targetPosition);
    2. relativeTargetPosition.x = Mathf.Clamp(relativeTargetPosition.x, MIN, MAX);
    This works perfect but it works on world axis so once he changes direction against world axis the camera screws up can i change it to stick to the characters axis?
     
  22. SiMKiNG

    SiMKiNG

    Joined:
    Dec 2, 2013
    Posts:
    14
    i tried
    relativeTargetPosition.x = Mathf.Clamp(playerTransform.position.x, -1, +1);
    but kinda does the same thing after a turn its not right lol
     
  23. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    It took a little bit of work but I think that I have something that will work. First, add the following to PlayerController.cs:

    Code (csharp):
    1.  
    2.   public Vector3 GetCenterPosition()
    3.   {
    4.     Vector3 center = thisTransform.position;
    5.     if (curveTime != -1 && curveTime <= 1 && platformObject != null) {
    6.       Vector3 curvePoint = GetCurvePoint(curveMoveDistance, true);
    7.       center.x = curvePoint.x;
    8.       center.z = curvePoint.z;
    9.     } else {
    10.       center.x = startPosition.x * Mathf.Abs(Mathf.Sin(targetRotation.eulerAngles.y * Mathf.Deg2Rad));
    11.       center.z = startPosition.z * Mathf.Abs(Mathf.Cos(targetRotation.eulerAngles.y * Mathf.Deg2Rad));
    12.       center += (turnOffset + curveOffset);
    13.     }
    14.     return center;
    15.   }
    16.  
    And then modify those same CameraController lines to the following:
    Code (csharp):
    1.  
    2.   Vector3 relativeTargetPosition = playerTransform.TransformPoint(targetPosition);
    3.   Vector3 centerPosition = playerTransform.rotation * Vector3.Scale(inGamePosition, playerTransform.localScale) + playerController.GetCenterPosition();
    4.   relativeTargetPosition.x = Mathf.Clamp(relativeTargetPosition.x, centerPosition.x - 1, centerPosition.x + 1);
    5.   relativeTargetPosition.z = Mathf.Clamp(relativeTargetPosition.z, centerPosition.z - 1, centerPosition.z + 1);
    6.  
    You should make the 1 value from Mathf.Clamp into a variable so you can easily modify it but other then that it will work with all directions.
     
  24. reiannd

    reiannd

    Joined:
    Aug 11, 2014
    Posts:
    7
    hi @opsive how can i change the scenes and platform? please help me. im making an inifinite runner agame and i want it ot be running in the streets. how can i change the venue? please reply. thanks!
     
  25. reiannd

    reiannd

    Joined:
    Aug 11, 2014
    Posts:
    7
    hey sir @Dharma_raj can you please help me. on how to change the venue of this starter pack? how did you do it sir? thanks!
     
  26. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
  27. SiMKiNG

    SiMKiNG

    Joined:
    Dec 2, 2013
    Posts:
    14
    Thanks Opsive worked perfectly!!
     
  28. SiMKiNG

    SiMKiNG

    Joined:
    Dec 2, 2013
    Posts:
    14
    ok so i did what you said before by just duplicating my model so the same scene extends for longer. I basically have 5 stuck together now :) but my first scene had an override size of 14 now that its 5 times longer i changed that to 70 but it seems like its overlapping different scenery's now any idea why?
     
  29. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    Instead of having a SceneObject on each of the 5 child scenes, just place one SceneObject on the parent of the five child scenes. You should then set the override size on that one scene object.
     
  30. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    Version 1.6.1 of the Infinite Runner Starter Pack Pro will be released shortly on the Asset Store and is available for download if you purchased via opsive.com. You can take a look at the full set of changes here.

    The major new feature of this release is uGUI support. Take a look at this help topic for how to switch to the new uGUI scene.
    StarterPackuGUI.png
     
  31. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    Version 1.6.1.1 of the Infinite Runner Starter Pack Pro has been released shortly on the Asset Store and is available for download if you purchased via opsive.com. You can take a look at the full set of changes here. This is completely a bugfix release.
     
  32. TWaanders

    TWaanders

    Joined:
    Mar 27, 2013
    Posts:
    46
    Hi Opsive,

    I imported the lastest version of this asset and set out to replace the character with my own character based on your instructions. As soon as I run the game I get the following error message, which suggests something is wrong with the animations:

    Could you point me in the right direction?

    Cheers!
     
  33. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    Did you use the Character Creation Wizard? Line 66 of PlayerAnimation points to an error with the backwards death animation name.
     
  34. abhishek1191

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    Hi @opsive I am having some issues with lighting my scenes in the game. I am using the diffuse curve shader on each asset and when I try to add any lights be it point or directional, it merely shows any difference. Please help!
     
  35. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    I haven't seen that issue before - is it reproducible with the sample scene?
     
  36. cruzan2

    cruzan2

    Joined:
    Jul 16, 2014
    Posts:
    4

    I am having the same issue when I change the shader it works fine.
     
  37. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    Can you tell me how to reproduce? At least in the sample scene, most of the lights are lightmapped so in order to see the light changes you need to bake the scene.
     
  38. abhishek1191

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    @opsive Ok...let me try baking the scene first.
     
  39. abhishek1191

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    @opsive yes! I can see the effect of lighting after I baked the scene. But it will be quite difficult to add lights to my scene when I have to bake the scene every time I add or make a change to a light to see the changes.
     
  40. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    Great to hear! When you are adding lights, switch the shader to a built-in Unity shader (such as diffuse) so it will show the realtime lights as well. Then you can bake the lights and switch the shader back.
     
  41. pez_86

    pez_86

    Joined:
    Jan 28, 2014
    Posts:
    17
    Hi there,

    You helped us out a while back with some of the curve shader related stuff, and we're back again to see if you can help us out one last time!

    We're just trying to set up something up that uses the curve shader, but so it isn't flat colour.
    i.e It needs to pick up information from our directional lights (like a normal diffuse shader would).
    Not sure if that's a simple line of code to add to the diffuse curve shader or not?

    We've also released our game that all began with this starter pack, so if you'd like to check it out here's the trailer, and here's the AppStore link.

    Cheers!
     
  42. EndlessRunner

    EndlessRunner

    Joined:
    Oct 23, 2014
    Posts:
    2
    @opsive,

    I just downloaded the Endless Runner pack and imported it into a blank Unity 4.5.5f1 project, but I am hit with the following errors when I try to run the MainScene:

    Code (CSharp):
    1. IndexOutOfRangeException: Array index is out of range.
    2. InfiniteRunner.Game.StaticData.GetCharacterPrefab (Int32 character) (at Assets/Infinite Runner/Scripts/Game/StaticData.cs:86)
    3. InfiniteRunner.Game.DataManager.GetCharacterPrefab (Int32 character) (at Assets/Infinite Runner/Scripts/Game/DataManager.cs:241)
    4. InfiniteRunner.Game.GameManager.SpawnCharacter () (at Assets/Infinite Runner/Scripts/Game/GameManager.cs:93)
    5. InfiniteRunner.Game.GameManager.Start () (at Assets/Infinite Runner/Scripts/Game/GameManager.cs:78)
    6.  
    7. NullReferenceException: Object reference not set to an instance of an object
    8. InfiniteRunner.InfiniteObjects.ObstacleObject.Start () (at Assets/Infinite Runner/Scripts/InfiniteObjects/ObstacleObject.cs:56)
    9.  
    10. NullReferenceException: Object reference not set to an instance of an object
    11. InfiniteRunner.InfiniteObjects.ObstacleObject.Start () (at Assets/Infinite Runner/Scripts/InfiniteObjects/ObstacleObject.cs:56)
    12.  
    Any ideas on how I can fix this? I've tried the following to fix it, but am still running into the same issue:
    1. Use a new project
    2. Delete the downloaded asset, re-download and re-import from Unity Asset Store.
     
  43. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    @pez_86 -

    Congratulations on releasing Shred It - I love the art style. Do you mind if I list it on my site and possibly the Asset Store images to help promote the starter pack? I'll make sure to mention the name to give you credit.

    In terms of your question, I have a version of the curved shader that takes realtime lights, a normal map and a specular color. You can then remove what you don't need. Send me a PM/email with your invoice number and I'll send you a link to this shader.

    @EndlessRunner -

    The character prefab index is stored using PlayerPrefs so it uses the registry on Windows or preferences file on Mac. Because of this it persists across projects. To completely remove everything, just do a PlayerPrefs.DeleteAll() at the start of an executing component (such as the GameManager). This will clear out the preferences and you won't get that error anymore. Make sure you remove the line after you have started it once otherwise it will keep removing hte preferences.
     
  44. EndlessRunner

    EndlessRunner

    Joined:
    Oct 23, 2014
    Posts:
    2
    Awesome, that's fixed it - thanks for the lightning fast response!
     
  45. pez_86

    pez_86

    Joined:
    Jan 28, 2014
    Posts:
    17
    PM'd you our invoice number.

    Cheers,
     
  46. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    I didn't receive that PM - can you try it again? Alternatively you can email support@opsive.com.
     
  47. cruzan2

    cruzan2

    Joined:
    Jul 16, 2014
    Posts:
    4
    Hello Opsive,

    Can I get copy of the shader as well.

    Thanks,
    Stanley
     
  48. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,119
    Sure - send me a PM or email with your invoice number.
     
  49. cruzan2

    cruzan2

    Joined:
    Jul 16, 2014
    Posts:
    4
    Email sent with invoice info.
     
  50. pez_86

    pez_86

    Joined:
    Jan 28, 2014
    Posts:
    17
    Sent an Email as well.

    Cheers,