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

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    Hi @opsive,
    I am facing a small problem, i want to remove rect transform of the gameObject which is inside the main camera so that we can use the same object for different resolutions. so what changes we have to do in GUIManager to do so.
    thanks.
     
  2. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    You are referring to the uGUI scene, right? The GUIManager doesn't reference any RectTransforms so there's not a reason why you can change/remove it.
     
  3. Leuthil

    Leuthil

    Joined:
    Jul 26, 2013
    Posts:
    97
    Did anyone get light probes working with this?
     
  4. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Unfortunately since light probes only work on static objects they won't work with the dynamically generated objects.
     
  5. Leuthil

    Leuthil

    Joined:
    Jul 26, 2013
    Posts:
    97
    Hmm that's what I feared. Anyway thanks for confirming for me.
     
  6. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109
    Hey Guys! Hope you all enjoy developing with this kit.
    I wish to announce you that WataWaka is now available world wide for download. Please check it out.

    Appstore link here
    GooglePlay link here
     
    opsive and mimminito like this.
  7. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Downloading on iOS now :)
     
  8. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109
    Thanks mimminito:)
    Please provide your Review comments as well
     
  9. abhishek1191

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    @opsive Hi Justin, I have created sets of obstacles and also added coins and secondary in those sets, But when the player collects the secondary coin and when that set with the secondary coin spawns again in the game then the secondary coin is not there. Any idea what could be the problem?
     
  10. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    @abhishek1191 -

    It sounds like the coins aren't activating again. Try clicking on the various platforms and see if the coins have been positioned but are inactive. Are you running the latest version?
     
  11. abhishek1191

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    @opsive Hi, I tried clicking on the platforms but the secondary coin has just disappeared from the set after collecting it for the first time.
     
  12. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Does this same thing happen with primary coins? So you have a multiple secondary coins as a child of a GameObject, right? Does this parent object spawn and the secondary coin has just been removed?
     
  13. abhishek1191

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    No, this doesnot happen with the primary coins, and the parent object spawns correctly and the secondary coin just gets removed.
    Do I need to add collidable object script with the secondary coins?
     
  14. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    You should add the Collidable Object component to the parent object, but not directly to the secondary coin. I just tested it by changing the Coin Group coins from primary to secondary type and the coins spawned again without a problem. Are you running the latest version? If so, can you tell me how to reproduce it from the demo scene?
     
  15. abhishek1191

    abhishek1191

    Joined:
    Apr 13, 2014
    Posts:
    47
    Hi @opsive I added collidable object script to the parent and now secondary coins are spawning correctly. Thanks! :)
     
  16. upwardstudios

    upwardstudios

    Joined:
    Jun 7, 2015
    Posts:
    6
    Hi @opsive, when do you anticipate v 2.0 release will be ?
    I am a great fan of this runner and i bought it two weeks back but having a hard time putting in new scenes. Could you do an updated video of how to setup a scene, not the platform? Specially interested in something where you use a new model from the asset store, not one from this pack. Or give me some pointers, i have gone through all your suggestions on the forums and documentations
    Is it possible to just but one of the environments here and use that as a running environment for our main character here?
     
  17. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    @upwardstudios -

    We have started the planning for version 2 but haven't gotten into the full development phase yet. We are working on getting an update out for one of our other assets out first and then we'll be starting. It will probably be another month or so before we start.

    I can tell you though that we are getting rid of the separation between platform and scene objects. The drawback of getting them aligned properly wasn't worth the benefit that they provided. The original thinking was that you could use multiple platform types with a single scene but I don't remember this being used by anybody so we are just going to go with a single object system.

    In the current version you can actually already prep for this - just don't use any scene objects. The system will have no problem with there being no scene objects within the Infinite Object Manager scene array. This should make it really easy to setup.

    Besides this, the process for setting up the objects should be the same whether you are using a model from the Asset Store or from the pack. Create the prefab, assign the correct Infinite Object component, and then assign it to the Infinite Object Manager. Which part specifically are you having problems with?
     
  18. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    First off I'd recommend that instead of having separate platform and scene objects, you instead combine them into one prefab. You can then place all of these objects under the "Platform" array within the Infinite Object Manager and leave the "Scene" array blank. This will make transitioning to version 2 as we are completely getting rid of the scene objects. They ended up not being used in the way that I imagined and instead caused more headache then they are worth. The current version will work just fine without any scene objects. Once you do that lets see if you continue to have this problem.
     
  19. nburlock

    nburlock

    Joined:
    Apr 11, 2013
    Posts:
    65
    Fast response thanks.

    I started randomly changing values and found that it only works properly if add an X offset to the square blocks that is half the block width. I don't know why it's just the X, but I guess it was in the instructions somewhere, but I missed it.

    I actually make use of the scene/platform separation. I use large blocks and I've got a small number of scenes and a large number of platforms which have the pickups and obstacles embedded in pre-designed patterns. It doesn't matter about V2, I won't be upgrading because I've made a lot of changes to the existing code.
     
  20. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Glad you got it figured out! The Infinite Runner Starter Pack has been on the Asset Store for just over two years now and you are the first person to use the scene/platform separation as I had imagined. Most use cases involve just matching up the same platform to the same scene.
     
  21. nburlock

    nburlock

    Joined:
    Apr 11, 2013
    Posts:
    65
    > you are the first person to use the scene/platform separation as I had imagined

    At least someone made use of your hard work :)

    I suppose the logical way to do it is to separate platforms and scenes because I'm not using a random layout. It would make sense to combine the two if the game is random though.
     
  22. upwardstudios

    upwardstudios

    Joined:
    Jun 7, 2015
    Posts:
    6
    How would you change camera angles during game play, so for a scene the camera would be on the left or right of the player for 10 seconds and then move behind him ?
     
  23. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    When the game starts up the method CameraController.StartGame is called. This will set the target position and rotation that the camera should move to. What you could do is instead of having this position be set to the in game position and rotation, you could instead have it set to the left or right of the character. You would then wait 10 seconds and update the target position/rotation again. The CameraController uses this target position and rotation within LateUpdate so the camera will move to whatever these variables are set to.
     
  24. upwardstudios

    upwardstudios

    Joined:
    Jun 7, 2015
    Posts:
    6
    Is there a way to switch "environments" on the fly with this pack. For example some runner games have different themes that you can buy, for ex: asian environment, forrest env. etc. that is then used in the game. Any pointers on how we can implement that ?
     
  25. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    You could have each environment be a different section, and then within the Section Selection component you would specify the section index for the environment that you want to run.
     
  26. upwardstudios

    upwardstudios

    Joined:
    Jun 7, 2015
    Posts:
    6
    Is that the same way we would do say a portal transition scene from one environment to another ?
     
  27. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Yes, that's the same idea. When you do the transition you'll update the Section Selection component so it starts to point to the new environment index.
     
  28. nburlock

    nburlock

    Joined:
    Apr 11, 2013
    Posts:
    65
    Sometimes when I'm play testing my game it stops building scenery at the end of a section. Following this all I see are paths and it will not produce scenery again until the game is restarted. I though it might be because the blocks weren't fitting, so I created some "filler" blocks which were 14 units long and have a 100% probability of appearing. Even so, every now and then the game will still fail to produce scenery. There are no errors, and it's so intermittent I can't tell if any change I make is helping because it always seems to show up again. Do you have an suggestions? Should I overlap sections? Is there something else I can try?

    Edit: Where would I put an error message explaining why it happened if the game decided that no scenery could be placed into the world? For example if it decided that no scenery block matched the path, then I'd like to know which path and why no block would fit.
     
    Last edited: Aug 3, 2015
  29. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Cases like this are harder to debug so I've started to recommend that you combine your platform and scene objects into one prefab. Within the Infinite Object Manager you will then leave the scenes array blank. In version 2 there won't be a concept of scenes at all anymore, everything will just be one object. This makes alignment a ton easier.
     
  30. nburlock

    nburlock

    Joined:
    Apr 11, 2013
    Posts:
    65
    The project would be unmanageable like that because there would literally be hundreds of scenery/platform block combinations.

    I just noticed that the section lengths weren't multiples of 14. Maybe that's the problem because it could end up in a situation where there's less than 14 units left before the section change which might result in no scene block fitting? I'll try it and hope the problem goes away.
     
  31. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    I guess I may not have realized how much people actually use the scene and platform separation. Whenever I was helping with somebodies project the scenes and platforms were always at a one to one ratio. Anyway, the length of the platforms and scenes don't matter as long as they are a multiple of each other. For example you could have a platform with a length of 10 and a scene with a length of 20 and it would match up. What you cannot do is have a platform a length of 10 and have it match up to a scene with the length of 15.
     
  32. nburlock

    nburlock

    Joined:
    Apr 11, 2013
    Posts:
    65
    > I guess I may not have realized how much people actually use the scene and platform separation.

    I have no need for this in V2 because I'm going to stay on V1 for this project. However, if you can leave it in, it might be a good idea because it allows it to be more flexible. If you did keep it, it would be useful to have something that can run through all the scenes to make sure that the paths match. The main problem I've found is that I'm accidentally connecting double length paths to triple length scene blocks or vice-versa and then I don't know it's happened until I see a glitch in the game while testing.

    It's a good project though, and I can live with V1 as is.
     
  33. AlanGreyjoy

    AlanGreyjoy

    Joined:
    Jul 25, 2014
    Posts:
    192
    So... you're saying that instead of using scene objects... just make everything into the platform instead? I have noticed that.... straights and turns will align perfect. Then after about a min, they are ALL OVER the place lol.
     
  34. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    That's correct. If you only use platforms then you won't have any alignment issues at all.
     
  35. AlanGreyjoy

    AlanGreyjoy

    Joined:
    Jul 25, 2014
    Posts:
    192
    Wow... just got done doing that.... soooo much better. so... the big question would be, what are the scene objects for then?
     
  36. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    They allow you to have multiple scenes per platform so in theory you wouldn't have to have as many objects. I found that most people weren't using them this was and it was mostly a one to one mapping. This is why I am now recommending that you don't use scene objects and instead just stick to platforms.
     
  37. AlanGreyjoy

    AlanGreyjoy

    Joined:
    Jul 25, 2014
    Posts:
    192
    I've noticed that... you can't kill moving obstacles. I think its because of the object needing two colliders. Any simple fix for that?
     
  38. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Which type of attacking are you using? If you are using the projectile you can change ProjectileObject.OnTriggerEnter from:
    Code (csharp):
    1.  
    2. if ((obstacle = other.GetComponent<ObstacleObject>()) != null) {
    3.  
    to:
    Code (csharp):
    1.  
    2. if ((obstacle = other.GetComponentInParent<ObstacleObject>()) != null) {
    3.  
    You can do something similar for a fixed attack within PlayerController.Attack:

    Code (csharp):
    1.  
    2. ObstacleObject obstacle = hit.collider.GetComponent<ObstacleObject>();
    3.  
    to:
    Code (csharp):
    1.  
    2. ObstacleObject obstacle = hit.collider.GetComponentInParent<ObstacleObject>();
    3.  
     
  39. AlanGreyjoy

    AlanGreyjoy

    Joined:
    Jul 25, 2014
    Posts:
    192
  40. AlanGreyjoy

    AlanGreyjoy

    Joined:
    Jul 25, 2014
    Posts:
    192
    I know I bought this such a long time ago lol... but I am having a blast with it now!
     
    opsive likes this.
  41. AlanGreyjoy

    AlanGreyjoy

    Joined:
    Jul 25, 2014
    Posts:
    192
    Hey... I am adding a jump audio effect. I added it to the audio manager.... what do you think would be the best way to tie it in when I jump?

    I went lazy and put it in the playeranimation.jump lol
     
    Last edited: Aug 19, 2015
  42. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    That would work, though I recommend placing it in PlayerController.Jump. This will allow you to add other audio events when the player does something but an animation isn't necessarily played.
     
  43. AlanGreyjoy

    AlanGreyjoy

    Joined:
    Jul 25, 2014
    Posts:
    192
    Yea, I moved it to the playercontroller lol. Needed to add some sounds when I straffed and slide.

    But there is one problem...

    The Player Creation Wizard... it saves the wrong particle prefabs.

    Even though I have changed out every single particle for my character, when I move the character to the "Copy a particle system from another player" section in the creation wizard. It will always put in the asset default particles and not what I had there.

    I have searched and searched through the creation wizard editor and various scripts... and I just can not figure out what is causing it.

    It seems it's very hard coded... how so I fix this?
     
  44. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    The particle system isn't very scriptable so when you place in another character to copy the particles from it does the best that it can. You'll need to customize your particles after the fact within character/particles GameObject.
     
  45. AlanGreyjoy

    AlanGreyjoy

    Joined:
    Jul 25, 2014
    Posts:
    192
    Alright.

    How about this, where at do you have it scripted to add those exact particle effects under the Particles GameObject?

    I see where it's named, added, and parented to the transform of the Particles GameObject in the creation wizard... But how does it know to add those particles?

    I am just going to have to hard code it in, just need a good pointer :)
     
  46. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    The CreateParticleSystem method will create the actual particle system GameObject, and then CopyParticleSystem will copy as many ParticleSystem values as it can.
     
  47. AlanGreyjoy

    AlanGreyjoy

    Joined:
    Jul 25, 2014
    Posts:
    192
    That's where I am confused.

    How does this make alllllll those settings for the default particle effects?
    Code (CSharp):
    1. private ParticleSystem CreateParticleSystem(string name, Transform parent)
    2.         {
    3.             GameObject particle = new GameObject(name);
    4.             particle.transform.parent = parent;
    5.             ParticleSystem particleSystem = particle.AddComponent<ParticleSystem>();
    6.             particleSystem.playOnAwake = false;
    7.             return particleSystem;
    8.         }
    Last time I checked, simply adding a particle system to a object does not give you a big beautiful purple spinning ball.

    Now, I have re-written this part to instantiate a prefab with all my particles instead of what you have here. It would work ok... if I didn't need to adjust the characters y value a couple blocks above this. With that value, it add's onto anything that I instantiate in the y value of all it's children. And even if i set the transform.position, that stupid y value mess's it all up lol.
    Code (CSharp):
    1. character.transform.position = new Vector3(0, -1.2f, 0);
    Sorry I am having a hard time with this part. I have over 75 characters to add.. just trying to make this more easy for me.

    So, how is this asset making a giant, beautiful, spinning, glowing ball that's purple. If all CreateParticleSystem is doing is AddComponent<ParticleSystem> ??

    Thanks :)

    Better yet, how does it know to had ANY particle effects if you DON'T have a source added to the creation wizard? That's what I want to know.
     
  48. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    That's a ton of characters :eek:

    In addition to creating the ParticleSystem, CopyParticleSystem copies all of the fields using EditorUtility.CopySerialized. This is probably where it is purple ball is coming from.

    Instantiating a prefab with all of your particles should work well - I'm not following the part where the y position is incorrect. Can't you just adjust the position of the instantiated prefab to allow it to be aligned correctly with the character?
     
  49. AlanGreyjoy

    AlanGreyjoy

    Joined:
    Jul 25, 2014
    Posts:
    192
    Hey.

    So... while I hunt down the invoice number (bought this back when I refused to use banks lol. My college classmate and I were goofing around with unity, gave him the money :p) can you shed some light on this problem?


    Over time, the array index for obstacles and and platforms will no longer resize.
    Code (CSharp):
    1. IndexOutOfRangeException: Array index is out of range.
    2. InfiniteRunner.InfiniteGenerator.InfiniteObjectHistory.LoadInfiniteObjectPersistence (.InfiniteObjectPersistence persistence) (at Assets/Infinite Runner/Scripts/InfiniteGenerator/InfiniteObjectHistory.cs:557)
    3. InfiniteRunner.InfiniteGenerator.InfiniteObjectGenerator.ShowStartupObjects (Boolean tutorial) (at Assets/Infinite Runner/Scripts/InfiniteGenerator/InfiniteObjectGenerator.cs:154)
    4. InfiniteRunner.InfiniteGenerator.InfiniteObjectGenerator.Start () (at Assets/Infinite Runner/Scripts/InfiniteGenerator/InfiniteObjectGenerator.cs:96)
    5.  
    And then it can't find the playerTransform either.
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. InfiniteRunner.InfiniteGenerator.InfiniteObjectGenerator.MoveObjects (Single moveDistance) (at Assets/Infinite Runner/Scripts/InfiniteGenerator/InfiniteObjectGenerator.cs:459)
    3. InfiniteRunner.Player.PlayerController.LateUpdate () (at Assets/Infinite Runner/Scripts/Player/PlayerController.cs:402)
    4.  
    At one point, I could no longer do 15 obstacles... then 10... and now I am down to 3 lmao. After that, the array just takes a poo.

    Now the platforms are doing the same.

    Now... this might be unity.

    I had this EXACT problem when I was adding onto the StaticData. Even though.. plain as day... you were re sizing the array for the foreach loop for new characters, I had to manually update each new option for the array to resize... pain in the ass lol. Sometimes Unity would work... after about 5 mins, I would get the arrayoutofindex. So like I said, I just added 3 more conditions for my 3 new options to the character part of the staticdata. And poof... started to work fine.

    Any clue as to why obstacles and platforms are throwing the error?

    Thanks guy!

    Edit,
    One last note, the framerate for this on mobile is up and down. If the frame rate is terrible, I'll die on purpose, then do another run and its perfect lol.
     
  50. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    When you are changing prefabs within the Infinite Object Manager make sure you first remove the startup objects, otherwise the startup objects could be referencing an object that doesn't exist. In terms of the performance, take a look at this page:

    http://docs.unity3d.com/Manual/MobileOptimizationPracticalGuide.html

    Alpha blending in particular is slow on mobile so that can really hurt performance