Search Unity

Official Endless Runner Sample Game Q&A

Discussion in 'Community Learning & Teaching' started by Aurore, Aug 15, 2017.

  1. Aurore

    Aurore

    Director of Real-Time Learning

    Joined:
    Aug 1, 2012
    Posts:
    3,106
    This is the official thread for discussion, issues and Q&A for the Endless Runner Sample Game (Trash Dash)

    Please use this thread if you have any questions, issues or feedback on this project.

    This is a project we have released on the Asset Store

    We also have a user guide in the Instructions of the project, as well as on our Learn Site



    We have also released this full game on the Google Play & App Store with all the proceeds of the game going to Game Changer charity.
     
    Last edited: Aug 15, 2017
    Kasaie and Mauri like this.
  2. f1b0n4cc1

    f1b0n4cc1

    Joined:
    Aug 27, 2015
    Posts:
    38
    Thanks for this project, it will help many game developers to improve their skills on Unity
     
  3. Shizola

    Shizola

    Joined:
    Jun 29, 2014
    Posts:
    476
    Thanks for the project. I've only had a quick look, but the way some of the assets work confuses me. There's a red bin and a blue bin which share the same material and texture with no colour information. What is this voodoo?
     
  4. hellobard

    hellobard

    Joined:
    Sep 26, 2012
    Posts:
    140
    Thanks for sharing this project, very interesting to see how a game like this is made.
    One question though, if I change the name of the asset bundle (Cat) from Trash Cat to anything else, the game loads but without the cat and throws and tells the object I want to instantiate is null. Where is the reference in the code for the name Trash Cat and how can I avoid this?
     
  5. UnityGuillaume

    UnityGuillaume

    Unity Technologies

    Joined:
    Mar 16, 2015
    Posts:
    123
    Lots of objects in the project use vertex color (painted in the 3D software like maya/3ds/blender) to cut down on textures size (and because they all started as using only vertex color and some had textures added later when there was a need for more details).

    If you find the mesh (e.g. search for WheelyBinBody) you can see on the preview at the bottom the inspector that the mesh have uv and colors information per vertex.

    The shader (CurvedCode.cginc) then multiply the vertex color by the texture color (which is greyscale) allowing for varaition in tint across the mesh.

    To keep thing relatively simple, the game use the character name as the key saved in the save file to know which character is owned & used (to be more robust we could build some kind of unique ID system per character so you can change the name and retain the character, but that is left as an exercise to the reader :p)

    When the game create a savefile, it grant ownership of Trash Cat by default. So the game will try to instantiate the character called Trash Cat and will fail if it don't find it.

    To modify that, look for the PlayerData.cs script, and for the function NewSave() in that script. You will see there that we add to the character list Trash Cat (and to the theme list Day). You can change that to the name of your new character here so it work.

    *Note*: after modifying the script, you will need to Clear the save file (either through the Trash Dash Debug menu in the editor or in game, in the settings popup with the Delete Data button) so that the game regenerate a new one with the proper character added to the player save.
     
  6. hellobard

    hellobard

    Joined:
    Sep 26, 2012
    Posts:
    140
    Thank you for the reply!
    That was easy enough, interesting to see how you handled that part of the game.

    Also, I'm trying to find how the pickups are being distributed on the track, but I can't seem to find where that's being done in the code?
     
  7. UnityGuillaume

    UnityGuillaume

    Unity Technologies

    Joined:
    Mar 16, 2015
    Posts:
    123
    If you look in TrackManager.cs, there is a function called SpawnCoinAndPowerup() that take care of spawning the "coins" (here the fishbones), premium currency and powerup. It will pick a purcentage of chance that a powerup will be spawn instead of a "coin" (that purcentage grow with time, so that after a while we are sure to spawn one).
     
  8. Shizola

    Shizola

    Joined:
    Jun 29, 2014
    Posts:
    476
    Can I ask how long it took you to make this project and how many people were involved?
     
  9. UnityGuillaume

    UnityGuillaume

    Unity Technologies

    Joined:
    Mar 16, 2015
    Posts:
    123
    For the time it took, it is a bit hard to tell precisly because it was made in parallel with other thing, But I would reckon that combined, it was roughly 6 month of works from start of the project to release on store.

    As for the team, "full time" : one producer, one artist & one programmer.

    We had an animator who worked a couple of week for the animations and a contractor for sounds/music.

    Finally some "external" QA (i.e. not done by the full time team :D) was done at the end of the project before submitting on the stores by an additional person.
     
    huayanpro likes this.
  10. Shizola

    Shizola

    Joined:
    Jun 29, 2014
    Posts:
    476
    Thanks Guillaume, this type of information is always useful to me.
     
  11. parag1

    parag1

    Joined:
    Jun 14, 2017
    Posts:
    2
    Thanks for the project.I want to change cat character.Can you help me ?
     
  12. murataksu740

    murataksu740

    Joined:
    Aug 5, 2017
    Posts:
    1
    how add character?
     
  13. SamerNajadao

    SamerNajadao

    Joined:
    Aug 24, 2017
    Posts:
    1
    Thankssssss brother ❤
     
  14. EvgOst

    EvgOst

    Joined:
    Sep 23, 2017
    Posts:
    1
    Very interesting project. I want to change my runner on its basis. There are ишп differences in it: several characters in the scene at the same time + they can move to the right and left, that is, the track has not 3 positions but rather a large area on which the characters can move. Where can I start the changes? Where can I change the parameters of the track? Characters are probably changing in PlayerData.cs?
     
  15. emi-albu

    emi-albu

    Joined:
    Aug 15, 2012
    Posts:
    9
    Is it possible to add a different track segment with a different curved rotation (given the current global shader)? Can you get the feeling you are changing direction like in the minion rush?
     
  16. en_ce

    en_ce

    Joined:
    Nov 11, 2017
    Posts:
    1
    Hi,
    Can I use the music used in this project on my own project? Do I encounter a copyright issue?
    Best regards...
     
  17. me_atif

    me_atif

    Joined:
    Dec 7, 2016
    Posts:
    2
    Hi Guys i am converting this game in WebGl but when i play it on local server xampp the character is not loading
    please help me
    i need your help urgently
     
  18. Riddlah

    Riddlah

    Joined:
    Mar 26, 2014
    Posts:
    19
    Hi. I have question regarding lighning used in Trash Dash. How it is implimented ? Even when I turn off directional light the game is lighted properly. So far as I saw, there is also no baked lightmaps. Can You tell me how it is implemented. I would also use proper mobile friendly lightning in my own endless runer, which also use pooling. Thank you for any answers. (Althought this thread seems inactive for long time :( )
     
  19. HappyCodeClub

    HappyCodeClub

    Joined:
    Feb 11, 2018
    Posts:
    1
    Everything in the project appears to be using the shader Unlit/CurverUnlit - I don't think there's any actual light being computed, the assets themselves were just created with bright-looking textures.
     
  20. grit

    grit

    Joined:
    Nov 12, 2013
    Posts:
    14
    I really enjoy exploring Trash Dash and I am learning a lot from it concerning the game structure and the track generation and such. Thanks a lot for providing such example projects!
    Also I find the curved shader very intersting. I am not very familiar with shaders (yet). I noticed that the curve is only intergrated in unlit shaders as far as I can see. Is it possible to apply the curve on shaders with lighting and / or combined with a Post Processing Profile e.g. Bloom, Depth of field etc.? And how? I fumbled a bit with putting "#include "CurvedCode.cginc"" into a lit shader, but I get an error message like:
    Shader error in 'Standard_gs': redefinition of '_MainTex' at Assets/Shaders/CurvedCode.cginc(21) (on metal)

    I don't really have a clue. Could you please point me into the right direction? Thank you!
     
  21. UnityGuillaume

    UnityGuillaume

    Unity Technologies

    Joined:
    Mar 16, 2015
    Posts:
    123
    Note : you will require some basic understanding on shaders (what are vertex/pixel shader, model/view/clip space etc.) to grasp how the shader work.

    CurvedCode.cginc is actually nearly the full shader. It is put in a include file just so I don't have to rewrite the whole shader code when I just want to switch some parameter like Blending, Zwrite or the render queue etc.

    As you can see in the file, it define
    sampler2D _MainTex;
    chance are your custom lit shader already define that _MainTex smapler, hence the conflict.

    But what make the curving is just a part of the vertex shader in the CurvedCode include file :

    Code (CSharp):
    1. v2f vert(appdata v)
    2. {
    3.     v2f o;
    4.     o.vertex = UnityObjectToClipPos(v.vertex);
    5.  
    6.      //THIS PART----------------------
    7.  
    8.     float dist = UNITY_Z_0_FAR_FROM_CLIPSPACE(o.vertex.z);
    9.  
    10.     o.vertex.y -= _CurveStrength * dist * dist * _ProjectionParams.x;
    11.  
    12.     //----------------------------------------------------------------
    13.  
    14.     o.uv = TRANSFORM_TEX(v.uv, _MainTex);
    15.  
    16.     o.color = v.color;
    17.  
    18.     UNITY_TRANSFER_FOG(o, o.vertex);
    19.     return o;
    20. }
    For each vertex of every object using that shader, it compute the distance of the vertex from the camera (UNITY_Z_0_FAR_FROM_CLIPSPACE) and use that distance as a ratio to offset it on the y axis in clip space (so the vertical axis).

    o.vertex.y -= _CurveStrength * dist * dist * _ProjectionParams.x;


    _CurveStrength is a float that is passed from script ( see the script WorldCurver.cs) so we can tweak the strength of the curving from a single point in the editor and we multiply by _ProjectionParams.x because some platform render with a flipped projection matrix, so negative y direction on some platform would curve the world upward. _ProjectionParams.x contains -1 on thsoe paltform, so the curve is happening in the right direction everywhere.


    So to use on it on a lit shader, either add that transformation in your vertex shader or if you're using a Surface Shader, add a vertex modifier function and do the same modification in that function (see here : https://docs.unity3d.com/Manual/SL-SurfaceShaderExamples.html the section called
    Normal Extrusion with Vertex Modifier for an example of how to write such function)
     
  22. grit

    grit

    Joined:
    Nov 12, 2013
    Posts:
    14


    Thank you so much, UnityGuillaume! Your explanation is really clear and I can follow your description. However, I have to learn a little more about the subject in order to apply this effectively. But I am eager to do so. :)
     
  23. hamd95

    hamd95

    Joined:
    Nov 30, 2016
    Posts:
    6
    thank you Unity for this awesome project
    the problem that i faced, when i try to build asset bundle for android (by clicking on Build AssetBundles )
    i have the following error
    Type `UnityEngine.Networking.UnityWebRequest' does not contain a definition for `SendWebRequest' and no extension method `SendWebRequest' of type `UnityEngine.Networking.UnityWebRequest' could be found. Are you missing an assembly reference?
    so what's the solution in this case?
     
  24. UnityGuillaume

    UnityGuillaume

    Unity Technologies

    Joined:
    Mar 16, 2015
    Posts:
    123
    Which version of Unity are you using? I think SendWebRequest was added in 2017.3 (but if you got it through the asset store in Unity, it should have given you a previous version)...
     
  25. hamd95

    hamd95

    Joined:
    Nov 30, 2016
    Posts:
    6
    yes i have Unity 2017.3.1f1
    should i update now for solving this error?
     
  26. hamd95

    hamd95

    Joined:
    Nov 30, 2016
    Posts:
    6
    In case of using bridge(or any thing to raise up, such as trains in subway surf), what should we add to code?
     
  27. UnityGuillaume

    UnityGuillaume

    Unity Technologies

    Joined:
    Mar 16, 2015
    Posts:
    123
    It would require quite some modification, as for now, the system assume a single path for all 3 lanes (the character is just offset in the x position based on the lane. Based on where the character is, it ask the TrackSegement what is the position it should be + its lane offset.

    One possible solution (very broad overview) would be to modify the script TrackSegment.cs :

    The script track segment have a transform property called pathParent. It's a transform that will have children which will define a path to interpolate along. In the current game, this path usually have only 2 child : the entry and the exit and it interpolate between.

    But you could add 2 other transform pathParent : pathParentLeft, pathParentRight, that have more than 2 children and define your "elevated" path on each pathParent with as many gameobject you need, and modify the function GetPointAt so it can take a parameter telling the system on which lane you want the path to be interpolated, and select the good pathParent for that path, and in the character controller ask the position for the current lane on which the character is.

    (side note, if you want to display the new paths like it is now done with a blue line in the scene view, look at the function OnDrawGizmos from TrackSegement)

    Of course that's only part of what need to be done, by default it may act weirdly when changing lane from a high to low lane and vice versa, or jumping/sliding when changing lane etc...
     
    hamd95 likes this.
  28. hamd95

    hamd95

    Joined:
    Nov 30, 2016
    Posts:
    6
    It's done, but yes i get some weird results, where the camera change it's position if the bridge is not on the center lane
    Whatever, Thanx for help.
     
  29. Pepsidog

    Pepsidog

    Joined:
    Apr 13, 2017
    Posts:
    28
    How do you add custom characters and themes?
     
  30. UnityGuillaume

    UnityGuillaume

    Unity Technologies

    Joined:
    Mar 16, 2015
    Posts:
    123
    ma3dru and JamesArndt like this.
  31. itamar87

    itamar87

    Joined:
    Aug 9, 2017
    Posts:
    1
    1.What is the purpose of using an UICamera in this project?
    All the canvas are in overlay render mode, so why did you add another camera?

    2. adding an UICamera would effect performances in some way?
     
  32. UnityGuillaume

    UnityGuillaume

    Unity Technologies

    Joined:
    Mar 16, 2015
    Posts:
    123
    1. It allow to display 3D model in a different position/scale etc. than the game Camera.

    Here it is used only for the character you see when selecting which character to play (if you look at the code you'll we assign it to the UI layer in the Loadout screen). We can have a point in front of the camera and just place the character here. Easier than to have to move the game camera just for the selection and place it back properly for the game.

    In the project, the UI camera end up using the same settings as the game camera, but a possible extension to that could be to play with FOV setting or stick post processing on it to make the character selection screen more interesting.
    We also had on "nice to have/try later" to display the level behind when selected, so it allow to display the character on top from a different perspective than the game camera (think overlay)

    2. It does but in a very negligible (read nearly non existing) way, because our UI camera have layer culling mask. it only display object in the UI layer (so nearly nothing, and the game camera don't display UI object, so no object are rendered twice) and render directly to screen on top of whatever was already rendered (so no setup cost of swapping render target etc..). The ratio : less code, easier to setup the shot over performance lost is clearly in favour of the ease of setup here
     
    itamar87 likes this.
  33. JoRangers

    JoRangers

    Joined:
    Nov 7, 2017
    Posts:
    26
    Hi, I have an issue with the endless runner with unity2017.4.4f1 for iOS with il2cpp

    I didn't modify the code of the project and when the game runs on iOS, it crashes when I press the button Start in the start scene.
    I got this error :
    Could not produce class with ID 212.
    This could be caused by a class being stripped from the build even though it is needed. Try disabling 'Strip Engine Code' in Player Settings.


    The error appears when the game is loading Asset Bundle : themes/default

    I also test on Android in il2cpp and I got the same error.

    Then I tried to modify the link.xml and add this ligne for the class with id 212 ( https://docs.unity3d.com/Manual/ClassIDReference.html )
    <type fullname="UnityEngine.SpriteRenderer" preserve="all" />

    I test on Android and all works fine.
    But the same test on iOS always give the same error.

    I found this post about an issue on il2cpp and dependencies :
    https://forum.unity.com/threads/boxcollider2d-not-working-on-link-xml-after-switch-to-il2cpp.357928/

    I tried all these link.xml :
    ---------------------------------------------------------------------------------------------------------------
    <linker>
    <assembly fullname="UnityEngine">
    <type fullname="UnityEngine.Animator" preserve="all" />
    <type fullname="UnityEngine.MeshRenderer" preserve="all" />
    <type fullname="UnityEngine.SkinnedMeshRenderer" preserve="all" />
    <type fullname="UnityEngine.MeshFilter" preserve="all" />
    <type fullname="UnityEngine.Advertisements" preserve="all" />
    <type fullname="UnityEngine.SpriteRenderer" preserve="all" />
    <type fullname="UnityEngine.Renderer" preserve="all" />
    </assembly>
    </linker>
    --------------------------------------------------------------------------------------------------------------
    <linker>
    <assembly fullname="UnityEngine">
    <type fullname="UnityEngine.Animator" preserve="all" />
    <type fullname="UnityEngine.MeshRenderer" preserve="all" />
    <type fullname="UnityEngine.SkinnedMeshRenderer" preserve="all" />
    <type fullname="UnityEngine.MeshFilter" preserve="all" />
    <type fullname="UnityEngine.Advertisements" preserve="all" />
    <type fullname="UnityEngine.SpriteRenderer" preserve="all" />
    <type fullname="UnityEngine.Renderer" preserve="all" />
    <type fullname="UnityEngine.Component" preserve="all" />
    <type fullname="UnityEngine.Object" preserve="all" />

    </assembly>
    </linker>
    --------------------------------------------------------------------------------------------------------------
    <linker>
    <assembly fullname="UnityEngine" preserve="all"/>
    </linker>
    --------------------------------------------------------------------------------------------------------------


    Nothing of these tests work on iOS

    I also test with unity2018.1.3f1 and the issue is the same. (with development build check & uncheck)

    Any idea to make this project works on iOS ?

    Thanks for your help
     
  34. femor

    femor

    Joined:
    Jun 29, 2018
    Posts:
    11
    1. ERROR: KeyNotFoundException: The given key was not present in the dictionary.
    happens after using up a power up

    2. power up amount doesn't update in store

    Tried modifying:
    TrackManager.cs
    Code (CSharp):
    1.  
    2. public void End()
    3.     {
    4.         .....................................
    5.         //if our consumable wasn't used, we put it back in our inventory
    6.         if (characterController.inventory != null)
    7.         {
    8.             if(!PlayerData.instance.consumables.ContainsKey (characterController.inventory.GetConsumableType ()))
    9.             {
    10.                 PlayerData.instance.consumables.Add (characterController.inventory.GetConsumableType (), 0);
    11.             }
    12.  
    13.             PlayerData.instance.consumables [characterController.inventory.GetConsumableType ()] += 1;
    14.             characterController.inventory = null;
    15.         }
    16.     }
    17.  
    18. LoadoutState.cs
    19. public void GoToStore()
    20.     {
    21.         PlayerData.instance.Save ();
    22.         UnityEngine.SceneManagement.SceneManager.LoadScene(k_ShopSceneName, UnityEngine.SceneManagement.LoadSceneMode.Additive);
    23.     }
    24.     ..............................
    25. void PopulatePowerup()
    26.     {
    27.         powerupIcon.gameObject.SetActive(true);
    28.  
    29.         if (PlayerData.instance.consumables.Count > 0)
    30.         {
    31.             Consumable c = ConsumableDatabase.GetConsumbale(m_PowerupToUse);
    32.  
    33.             powerupSelect.gameObject.SetActive(true);
    34.             if (c != null)
    35.             {
    36.                 if(PlayerData.instance.consumables.ContainsKey(m_PowerupToUse))
    37.                 {
    38.                     powerupIcon.sprite = c.icon;
    39.                     powerupCount.text = PlayerData.instance.consumables[m_PowerupToUse].ToString();
    40.                 }
    41.                 else
    42.                 {
    43.                     powerupIcon.sprite = noItemIcon;
    44.                     powerupCount.text = "";
    45.                     ChangeConsumable (1);
    46.                 }
    47.             }
    48.             else
    49.             {
    50.                 powerupIcon.sprite = noItemIcon;
    51.                 powerupCount.text = "";
    52.             }
    53.         }
    54.         else
    55.         {
    56.             powerupSelect.gameObject.SetActive(false);
    57.         }
    58.     }
     
  35. adeel1214

    adeel1214

    Joined:
    Jun 22, 2018
    Posts:
    7
    I am a beginner .
    I have the problem with endless runner/Trash cat game is running in editor but in andriod 2nd scene character selection is freeze...
    Any one help me..
     
  36. UnityGuillaume

    UnityGuillaume

    Unity Technologies

    Joined:
    Mar 16, 2015
    Posts:
    123
    Did you build the asset bundles and put them in the StreamingAssets folder before building for Android? You can get some information on how to do that in the file called INSTRUCTIONS.txt in the Assets folder of the project.
     
  37. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    Loading this project into a clean empty project in Unity 2017.3 results in errors. The error is as follows:



    Just upgraded to 2017.4 and the same errors appear.
     
    Last edited: Jul 3, 2018
  38. UnityGuillaume

    UnityGuillaume

    Unity Technologies

    Joined:
    Mar 16, 2015
    Posts:
    123
    Did you download the package in a version post 18.1 in the asset store? Then open a fresh project in 17.3, got to the asset store and clicked "import" on the Endless Runner?

    The asset store deliver different package based on which version of the editor is used. If you have a package for 17.3 cached but it got one for 18.1, it will show an "update" button on the Asset Store page to trigger a download of the newest version.

    But it don't handle "downgrading" package. So if the package cached on your machine was grabbed for 18.1, it won't trigger a redownload and re-import that in 17.3

    One thing to try is :

    - Open an empty project
    - in 17.3 or 17.4 go to your download page on the asset store (the box icon in the asset store toolbar, next to the home button)
    - Find Endless Runner
    - Click Download to force a re-download of the package, this time being given the one matching this editor version.
    - Then import

    Seems to have fixed it for me in 17.4 (with a package I had downloaded first in 18.1)
     
    JamesArndt likes this.
  39. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    I'm having some weird behavior and I can't track down the source. I am looking over the wiki as well, but it's slow going. So the Theme and the Powerups are persisting across transitions and saving. However it looks the Accessories are not saving and persisting across the Menu and the Game transitions. Here is a short video showing the issue. I've changed the character names being saved in "PlayerData.cs"...would that cause an issue with Accessories?

    I think this page https://github.com/Unity-Technologies/EndlessRunnerSampleGame/wiki/Save-File is getting me close but I am trying to wrap my head around it. If I've cleared the saved data using the Editor cheat menu will it revert to version 1?

    To be more clear I see the accessories I buy in the toggle list for them. I don't see it equipped to the character when I return to the menu though. The list defaults to "none" and no accessories appear on my character when I return to the main menu.

     
    Last edited: Jul 5, 2018
  40. Niyazmohammad

    Niyazmohammad

    Joined:
    Jul 23, 2016
    Posts:
    14
    How to reskin it?
     
  41. UnityGuillaume

    UnityGuillaume

    Unity Technologies

    Joined:
    Mar 16, 2015
    Posts:
    123
    Clearing the save will just delete the file on the disk, so next time the game load, seeing there is no save, will create a default new one.

    Versioning is here so you can be retro compatible with save from previous version of the game.

    Imagine you release your game to the public, and it save character name, current currency and score, then in your save file you would have those information :

    name
    currency
    score

    Now you update the game, and now you also save the max distance they reached. So when you read the save file you read name, then currency, then score then distance as you file now contains :

    name
    currency
    score
    distance

    The problem is, all the save file on your players machine don't have that score. So reading would fail. So to avoid that, you bump the version, and before reading the distance you check if the version is >= 2. If it's not, it's an old save file, so you put 0 in the score. Next time a save is written for that player, the version written will be 2 so next save file read will read everything.

    If you clear the save, as the file is deleted, it will just recreate a default save file with the current version


    Now for your problem, it's simply that in the current project, we never restore the previously used accessory nor save it in the save file! I had a bug with accessory being restored on the wrong character and disabled it temporarily...and it slipped through the crack and never re-enabled it :oops:

    To re-enable it you'll need a couple of thing :

    - First in LoadoutState.cs : look for the function PopulateCharacter and comment the 2 line that set usedAccessory to -1 at the top.
    Code (csharp):
    1. PlayerData.instance.usedAccessory = -1;
    2. m_UsedAccessory = -1;
    PopulateCharacter is called everytime we refresh the character (e.g. when coming back from the store), so that was resetting the accessory!

    - In LoadoutState.cs, at the top of the function ChangeCharacter, add those two line
    Code (csharp):
    1. PlayerData.instance.usedAccessory = -1;
    2. m_UsedAccessory = -1;
    otherwise, you could try to use an accessory on a character that don't have it! (e.g Trash Cat have 3 accessory, but Rubbish Raccoon only 2, so if you had the 3rd accessory equipped and switch to Rubbish Raccoon : exception!)

    - In Loadout.cs, at the top of the function GoToStore add :
    Code (csharp):
    1. PlayerData.instance.Save();
    otherwise, the currently used character won't be saved, and since the save file is read again when going back to the loadout screen, you would go back to the previous character!

    And now your accessory should be persistent! There may be some corner case I don't remember, but fixing those is left an exercise to the reader :p
     
    JamesArndt likes this.
  42. UnityGuillaume

    UnityGuillaume

    Unity Technologies

    Joined:
    Mar 16, 2015
    Posts:
    123
    JamesArndt likes this.
  43. adeel1214

    adeel1214

    Joined:
    Jun 22, 2018
    Posts:
    7
    I have an other problem with trash cat material is not load after building the asset bundle and put them in streming asset my target plateforn is android.
    Please give me answer.
    Your best wisher....
     
  44. adeel1214

    adeel1214

    Joined:
    Jun 22, 2018
    Posts:
    7
    And how we convert trash dash curve path in to straight path..
     
  45. UnityGuillaume

    UnityGuillaume

    Unity Technologies

    Joined:
    Mar 16, 2015
    Posts:
    123
    If your material are pink, it may be that your asset bundles were built with a different platform than the one you run on.
    e.g. if you build your asset bundle with the desktop platform, place them in streaming asset, switch to android and build the game to android, it won't work, because the shaders etc. in the bundle are all compiled for desktop platform, not for android.
    Be sure that you build your bundle for the platform you are building the game on (you should have a folder Android in StreamingAssets\AssetBundles. if ther eis only a folder Macox or windows or else, that mean the bundle aren't for the right platform).

    The curvature is made through a shader applied to all object. The amount of curvature is defined by a script WorldCurver.cs on the Main Camera. Either put the Curve Strength to 0, or use a simple Unlit shader on every material


    (sidenote: You can edit your post if you want to add another question to your post and no one have answer since then, it help keep the forum tidier and easier to follow, thanks!)
     
  46. adeel1214

    adeel1214

    Joined:
    Jun 22, 2018
    Posts:
    7
    Another question i am tried to change the coin which is fish but i face error.i am want to replace the fish object can you have any idea about this
     
  47. Niyazmohammad

    Niyazmohammad

    Joined:
    Jul 23, 2016
    Posts:
    14
    Video Tutorial is required I dont know how to do all setting in trashdash
     
  48. grit

    grit

    Joined:
    Nov 12, 2013
    Posts:
    14
    Hello there,
    does the game work on WebGL as well? I built the asset bundles for WebGL, copied them into the project and made a WebGL build. When I start the game tries to load the assets without success. I attached a capture of the console messages showing up on entering the menu screen and the store screen.
    I am wondering if I forgot something or if the game as is is not intended to run on WebGL without further adjustments or changing the handling of the sreaming assets.
    Thank you for hints,
    Grit.

    Bildschirmfoto 2018-07-31 um 14.55.13.png
     
  49. UnityGuillaume

    UnityGuillaume

    Unity Technologies

    Joined:
    Mar 16, 2015
    Posts:
    123
    Indeed the game wasn't tested for WebGL, so I can't say if it would work. Looking at the error though, it look like it can't load the asset bundle, which is normal (read "I never put code to handle WebGL :p) :

    To find where bundles are located to load them, we use Application.streamingAssetsPath, which return a "classic" path when on Desktop or iOs (e.g. C:/MyGame/Data/StreamingAsset) and a URL on other platform like Android (jar:file://etc...) or WebGL (http://localhost:9999/StreamingAssets/etc...)

    To unify the loading through the WWW class, the project use define in code to check for which platform the code is compiled and append file:// in front of the streamingAssetPath if not on Android. So in your case, it add file:// in front of the WebGL path that is already an URL, and it can't load file://https://localhost/etc... cause that's an invalid URL!

    To fix that, open AssetBundlesDatabaseHandles.cs in the Scripts folder, and look for
    Code (csharp):
    1. AssetBundleManager.BaseDownloadingURL = Application.streamingAssetsPath + "/AssetBundles/"+Utility.GetPlatformName()+"/";
    Just above it, the line
    Code (csharp):
    1. #if UNITY_ANDROID
    means that this line will only get compiled if you're on android. If you change it to
    Code (csharp):
    1. #if UNITY_ANDROID || UNITY_WEBGL
    then this line is now compiled for WebGL too, and the path should be fixed to the proper one.

    Please note that this is all from the top of my head, I didn't tested in the project, and the project could have a lot of other problem with rendering or the services etc..
     
    grit likes this.
  50. grit

    grit

    Joined:
    Nov 12, 2013
    Posts:
    14

    Thank you so much! This did the trick! :)

    Note: I also had to add:
    Code (csharp):
    1.  || UNITY_WEBGL
    in CharacterInputController.cs for the key input to work on a laptop for example.

    I am taking note of the project being not tested for WebGL, thus other problems could occur as you said. It is still fun to experiment a bit anyway. :)