Search Unity

Official Ruby’s Adventure: 2d Beginner Official Thread

Discussion in 'Community Learning & Teaching' started by Woolley_Kat, Apr 15, 2019.

  1. respectyoda

    respectyoda

    Joined:
    Apr 27, 2018
    Posts:
    11
    To avoid the effect from triggering when the scene starts, make sure the "play on awake" option for the hit particle effect is not ticked.
     
  2. unity_VVbgCK-6O_deTw

    unity_VVbgCK-6O_deTw

    Joined:
    May 27, 2020
    Posts:
    1
    Today I finished the tutorial. Just wanted to say thanks, it's been very straightfoward and I had a lot of fun doing it.

    There are some minor details that should be updated, accordingly to the newer Unity Editor interface, because the tutorial has some differences (minor ones). I had to google a couple of times to solve this issues, luckily all those issues were already answered on forums.

    Thanks again, Unity has been a great surprise to me.
     
  3. eXmart

    eXmart

    Joined:
    Apr 27, 2020
    Posts:
    1
    I have the same issue. Changing Camera to from Perspective to Orthographic fixed it. Main Camera->Projection : Orthographic
     
  4. nh0ctung

    nh0ctung

    Joined:
    Apr 24, 2020
    Posts:
    2
    Yo, this works for me too, i don't get it, it doesn't make any sense, lolll
     
    austin397 likes this.
  5. unity_gsGPm60fLZU1Sg

    unity_gsGPm60fLZU1Sg

    Joined:
    May 29, 2020
    Posts:
    1
    I need help this is on Lesson 10: Projecile

    The error occur with this line:

    projectile.Launch(lookDirection, 300);
     

    Attached Files:

  6. mietta25

    mietta25

    Joined:
    May 20, 2020
    Posts:
    1
    the reason why smokeEffect.Stop() not working is that, this code is stopping publicly attached smoke effect, not the child smoke effect attached to robot.

    to fix this issue,

    change the smoke effect's particle systems access modifier from public to private.

    i.e. "public ParticleSystem smokeEffect" to "private ParticleSystem smokeEffect

    then inside Start() function add this line

    smokeEffect = gameObject.GetComponentsInChildren<ParticleSystem>()[0];

    this code sets the 1st child particle system object attached to the robot.

    now smokeEffect.Stop() iniside fix function will work.
     
  7. shadowmonarch03

    shadowmonarch03

    Joined:
    May 23, 2020
    Posts:
    2
    Hi guys, I'm stuck at World Interactions collectibles. I have the correct script for the health collectibles, but it doesn't trigger or give me health after i started using damage zones. When I backtrack far enough, it works, but the final script they show just hasn't been working.
     
  8. theultimatebutt

    theultimatebutt

    Joined:
    May 24, 2020
    Posts:
    1
    so i'm at the part where you have to create a tile and rename it down in a folder called tiles i know that i need to download the 2d tile thing from the package manger but i cannot find it for the life of me
     
    Last edited: Jun 3, 2020
  9. shadowmonarch03

    shadowmonarch03

    Joined:
    May 23, 2020
    Posts:
    2
    I'm stuck on World Interactions - Projectiles and my cog is shooting, but it's not colliding with the robot, but it is colliding with other objects. Please help if you can.
     
    florawang0611 likes this.
  10. M3kT3k

    M3kT3k

    Joined:
    May 8, 2020
    Posts:
    1
    So I may have gone off the rails on the tutorial a bit, I now have evil exploding spiders, robot sheep that explode in an all too gory fashion, other building, etc. One issue I am having is with the projectile. It seems that it does not always fire nor is the rate of fire very fast, the animation plays as it is being shot but it does not appear. The projectile script is the same as the tutorial.

    ______________________________________________________________________

    Posting so this could help someone else. I determined the problem was that for some reason it would catch on the collider and basically destroy itself the moment it was created. I fixed this by doubling the look direction value before it is passed to the projectile script.

    projectile.Launch(lookDirection*2.0f, shot);

    By using the multiplication in this way the +/- value is maintained for the direction, but it gives the projectile a little more distance away from rub's colliders.
     
    Last edited: Jun 18, 2020
  11. Ittoryu

    Ittoryu

    Joined:
    Dec 21, 2015
    Posts:
    2
    Hi all,

    First of all, thank you so much for this tutorial as it is amazing!

    I am having issues with the Sprite animation bit.
    I followed the tutorial and everything, but I got two main issues:

    1) The robot will only go left to right, never up or down
    2) The robot will not actually use any of the animation, it will simply "slide" left to right with the legs open.

    Has anyone encountered this issue?

    My code:

    Code (CSharp):
    1. public class EnemyController : MonoBehaviour
    2. {
    3.     public float speed;
    4.     public bool vertical;
    5.     public float changeTime = 3.0f;
    6.     float timer;
    7.     int direction = 1;
    8.     Animator animator;
    9.  
    10.     Rigidbody2D rigidbody2d;
    11.     // Start is called before the first frame update
    12.     void Start()
    13.     {
    14.         rigidbody2d = GetComponent<Rigidbody2D>();
    15.         timer = changeTime;
    16.         animator = GetComponent<Animator>();
    17.        
    18.     }
    19.  
    20.     private void Update()
    21.     {
    22.         timer -= Time.deltaTime;
    23.  
    24.         if(timer < 0)
    25.         {
    26.             direction = -direction;
    27.             timer = changeTime;
    28.         }
    29.     }
    30.  
    31.     // Update is called once per frame
    32.     void FixedUpdate()
    33.     {
    34.         Vector2 position = rigidbody2d.position;
    35.  
    36.         if (vertical)
    37.         {
    38.             animator.SetFloat("Move X", 0);
    39.             animator.SetFloat("Move Y", direction);
    40.             position.y = position.y + Time.deltaTime * speed * direction;
    41.         }
    42.         else
    43.         {
    44.             animator.SetFloat("Move X", direction);
    45.             animator.SetFloat("Move Y", 0);
    46.             position.x = position.x + Time.deltaTime * speed * direction;
    47.         }
    48.        
    49.  
    50.         rigidbody2d.MovePosition(position);
    51.     }
    52.  
    53.     private void OnCollisionEnter2D(Collision2D collision)
    54.     {
    55.         RubyController player = collision.gameObject.GetComponent<RubyController>();
    56.  
    57.         if(player!= null)
    58.         {
    59.             player.ChangeHealth(-1);
    60.         }
    61.     }
    62. }
    63.  
    Currently on Unity 2019.4.1f1
     
  12. zxzera

    zxzera

    Joined:
    Jul 5, 2020
    Posts:
    4
    Hey, I'm having a bit of an issue with the collision on the enemy. It is never stated in the tutorial about how many pixels the enemy should be. Seeing how there are varying PPU used I made my enemy resemble the one in the tutorial, by judging how big the enemy was compared to Ruby. The problem is, I believe I scaled it wrong at 120 PPU and the box collider is underneath the enemy.

    It's a great tutorial but I'd like to suggest that you use a common PPU next time so that it is easier to be able to just set them all the same.

    I fixed it by adding Pivot Bottom, on the original image. I dont believe it was stated in the tutorial to do this but I may have missed it. I also changed the PPU (pixels per unit) back to 100.
     
    Last edited: Jul 24, 2020
  13. fcardonar14

    fcardonar14

    Joined:
    Jul 30, 2020
    Posts:
    1
    I am having issues editing the code of the robots so that they aren't able to go into the water. I thought just by them having a 2d collider and the tile map collider they avoid the water. any ideas?
     
  14. Pk0n

    Pk0n

    Joined:
    Oct 25, 2019
    Posts:
    6
    Jesus, thank you so much i can almost say i love you. Thank you very much, i was trying to solve this for like 2 days
     
  15. mitch_arene

    mitch_arene

    Joined:
    Jan 2, 2016
    Posts:
    1
    Thank you!! You just saved me a ton of hairpulling!!
     
  16. SiiriKok

    SiiriKok

    Joined:
    Sep 8, 2020
    Posts:
    1
    Hey, I'm having problems at the part Main Character and First Script 12: Using your code in Unity. Script should work, there's no problems with it in Visual Studio but it doesn't work in Unity. When I try to play the script Unity gives me an error "All compiler errors have to be fixed before you can enter playmode!"
     
  17. unity_NfxEqd44w0oDvA

    unity_NfxEqd44w0oDvA

    Joined:
    Sep 7, 2020
    Posts:
    1
    I was able to fix that problem by doing smokeEffect.Stop(true);
     
  18. pourpcxyz

    pourpcxyz

    Joined:
    Sep 14, 2020
    Posts:
    1
    Thank you so much for the clarity buddy, I was suppose to add some info beetv which is truly appreciated because you have taken care of it, thanks again.
     
  19. Jcruz0921

    Jcruz0921

    Joined:
    Sep 14, 2020
    Posts:
    1
    I need help with my animation portion of this tutorial. I added a new function to my RubyController script, but when I click play mode, my animation completely stops working. I'm not sure why that's the case since everything is written to the letter from this tutorial.
     

    Attached Files:

  20. MatrixLyn

    MatrixLyn

    Joined:
    Oct 10, 2020
    Posts:
    2
    Hi, i am having same problem. it is driving me nuts. Any solution? I tested using the blend tree and notice that there is already an issue here. If i drag the red dot from centre to top, right or down, the animation change to the respective animation (robottop,robotright, robotdown) correctly. However, if i push the red dot to the left, the preview still shows the right facing animation UNTIL I REACH THE LEFT DOT ITSELF (-0.5). I have really no idea what's going on...please help! :(

    I have uploaded an AVI file here in ZIP format to show this problem in the Blend Tree itself.
     

    Attached Files:

    Last edited: Nov 11, 2020
  21. davorhbk

    davorhbk

    Joined:
    Sep 30, 2020
    Posts:
    1
    I thank you not only for solving this problem, but also for that last sentence. It really made all the instructions above pretty clear.
     
  22. austin397

    austin397

    Joined:
    Nov 21, 2020
    Posts:
    2

    OH MY GOD THANK YOU SO MUCH!

    I spent hours trying to figure this out myself and redoing the tutorial 5 or 6 times. This has been the worst part of the whole tutorial.
     
  23. austin397

    austin397

    Joined:
    Nov 21, 2020
    Posts:
    2

    So I think I found the solution of how the tutorial meant to do it. You need to attach the child to the public field, not the pre-fab. If you attach the child it works like it is supposed to.
     
    sydneywr likes this.
  24. firozjokhi

    firozjokhi

    Joined:
    Nov 11, 2020
    Posts:
    19
    I am a beginner to Unity, but not to C#. Been trying to follow along on the Ruby tutorial, but the collision doesn't seem to work correct at all for me.

    I am attaching the screenshots for Ruby and the Cube. You can see the collision boxes, and the inspectors.

    The collision seems to occur somewhere above (y axis) the box instead of at the box. I am probably missing some silly thing, but I can't figure it out. The same thing is happening for the Poles and the Health. No collision when I am right on top of them, but instead Ruby collides against invisible stuff a bit above those objects.

    1. Please help me figure out what I am doing wrong.
    2. Any way to display collision boxes while in the game so I can see what is happening?
    3. For non-rigid objects (such as the cube) how do Log it's position?


    Thank you so much!
     

    Attached Files:

  25. CantMilkThose

    CantMilkThose

    Joined:
    Jan 5, 2021
    Posts:
    4
    I'm opening the project from the hub and it's on 3D. How can I change this? Alternatively can I just do the tutorial on 3D?
     
  26. Sly_R2

    Sly_R2

    Joined:
    Nov 30, 2020
    Posts:
    1
    I'm not seeing anyone else have this isse but my script is identical to what is being shown but my cog does not collide with the robot. It just zooms past it and the animation doesn't change as it's meant to. Can anyone help?
     
  27. xredghost

    xredghost

    Joined:
    Jan 17, 2021
    Posts:
    8
    So, I'm fairly early in the tutorial. I'm currently working on Tiles, I've made my "Tiles" folder, but I have no "RightClick>Create>Tile" option. I have all the packages I should need, so I'm wondering if there's a difference in the Unity version I'm using (2020.2.1fl).

    Any help is appreciated!
     
  28. cthormoto

    cthormoto

    Joined:
    Jan 21, 2021
    Posts:
    2
    I'm having the same issues, only my invisible collisions are somewhere to the bottom and left of the boxes.

    I've tracked it down to something having to do with the switch to using rigidbody2d in the script (the collisions work fine using the transform position. My collision boxes on the sprites are fine, but just like with you, the collision reads off to the side in-game.

    I'd love to have an answer, but in the meantime I'll see if adding the debug line output will help at all. :-/
     
  29. cthormoto

    cthormoto

    Joined:
    Jan 21, 2021
    Posts:
    2
    Next to the "shading mode" drop down, there's a little button that says "2D". If you click it, it should go between 2D and 3D mode.
     
    GregoryLane likes this.
  30. Hiccupskill

    Hiccupskill

    Joined:
    Dec 3, 2017
    Posts:
    1
    I am trying to do this tutorial for a second time i am at the beginning of it where you learn how to script ruby's movements. but every time i try to test it in the play mode she just starts moving to the right with no input from me and does not stop i have no idea why my code is the exact same as it says to make but it just doesnt work

    i cant figure out how to screencap on this computer but this is what i have typed up

    // Update is called once per frame
    void Update()
    {
    float Horizontal = Input.GetAxis("Horizontal");
    Debug.Log(Horizontal);
    Vector2 position = transform.position;
    position.x = position.x + 0.1f;
    transform.position = position;
     
  31. craz4cats

    craz4cats

    Joined:
    Feb 21, 2021
    Posts:
    1
    Hello everyone. I have ran into a problem with the robot not using the animation when walking. I did some googling and found no results. So I instead decided to search "unity 2020 animation -youtube" and try to solve this myself. Spoiler alert: success. If you're running into the same problem with your bot not using the animation when moving, try this. It worked for me and i hope it helps you. I'll update if i run into the same problem with Ruby. Also, the warnings i will post below.
    Go to your robot prefab, and in the inspector:

    upload_2021-2-23_11-17-40.png

    Change controller from none to bot, and that should work for you now. The warnings I was getting are as follows:

    Animator is not playing an AnimatorController
    UnityEngine.Animator:SetFloat(String, Single)
    EnemyController:FixedUpdate() (at Assets/Scripts/EnemyController.cs:49)

    and

    Animator is not playing an AnimatorController
    UnityEngine.Animator:SetFloat(String, Single)
    EnemyController:FixedUpdate() (at Assets/Scripts/EnemyController.cs:50)

    Edit: The page i found this info:
    https://docs.unity3d.com/Manual/animeditor-CreatingANewAnimationClip.html
     
    GregoryLane likes this.
  32. Stew_79

    Stew_79

    Joined:
    Feb 24, 2021
    Posts:
    36
    Hi guys
    I am stuck on chapter 10 Launching the projectile.
    I have 2 problems.

    First problem is with no input being pressed on the keyboard ruby is always facing up when idling
    All of Rubys movement animation is playing correct

    Second problem is ruby does not give movement to the cog after it has been instantiated.
    I can make the cog move if I am moving as I throw it but when idling it stays put on ruby.
    I think it has something to do with the lookdirection but I cant suss it out.


    This is driving me nuts please help
     
    Last edited: Mar 6, 2021
  33. Iorian_7

    Iorian_7

    Joined:
    Mar 16, 2021
    Posts:
    3
    Hi everyone.
    I have the same problem. I'm using 2020.3.0f1
    Any solution?
    Thanks a lot
     
  34. Iorian_7

    Iorian_7

    Joined:
    Mar 16, 2021
    Posts:
    3
    Ok here is the solution:
    You must have 2D Tilemap Extras from Package Manager
     
    NoHeroProductions likes this.
  35. dark_hand

    dark_hand

    Joined:
    Oct 20, 2019
    Posts:
    2
    I have same problem. I'm using 2020.3.0f1,too
    I have 2D Tilemap Editor ,but failed
    wrong version?
     

    Attached Files:

  36. dark_hand

    dark_hand

    Joined:
    Oct 20, 2019
    Posts:
    2
  37. Iorian_7

    Iorian_7

    Joined:
    Mar 16, 2021
    Posts:
    3
    I solved in this manner:
    Window>package manager: Unity Registry ---> gear of Advanced ---> enable preview packages

    So you can download 2D Tilemap Extras
     
    NoHeroProductions likes this.
  38. Hillychurl

    Hillychurl

    Joined:
    Apr 13, 2021
    Posts:
    1
    I had an extra script which was screwing this up. Check to make sure you only have one Projectile script and that the class name matches the script name.
     
  39. TheMikeDrop

    TheMikeDrop

    Joined:
    Mar 31, 2021
    Posts:
    2
    So, I was working on this project last night for about three hours. Saving along the way. However, when I went to close out and save for the whole night it said it could not save. It then gave me the option to try again, don't save, or cancel. I hit cancel, and then it deleted everything.

    I'm pretty much a complete newb at this. I'm on the 2020.3 editor. I was able to figure out a workaround for tile differences, but I can't figure out why it was lying to me telling me that it was saved. Also, when I create a new scene it has a really far camera box for the limitations.

    I tried to start up a new project with reinstalling the materials from the unity hub and it try closing out and saving it, but it still won't save it. I thought I remembered seeing something somewhere that talked about saving issues with unity and what to do, but I can't remember and can't find it. Any help is appreciated!
     
  40. Natural_amateur

    Natural_amateur

    Joined:
    Apr 9, 2021
    Posts:
    1
    EDIT: Found my mistake: I clicked on the "orange" blend tree, but missed to click the "grey" blend tree afterwards :facepalm

    I am at the point of adding animations, but I stuck with the instructions from the tutorial and the official unity manual states. I cant find a way to set blend type to 2D nor do I can add something to the motion field.

    Tutorial/manual:


    My view:
    upload_2021-4-27_21-44-33.png

    Any idea? Is "motions" now" transitions"?
     
    Last edited: May 1, 2021
  41. JJ81190

    JJ81190

    Joined:
    May 16, 2021
    Posts:
    1
    Hey there folks, trying to get though the particle section here and I've come to the part where I'm supposed to issue my own particle system for Ruby being hit and using a health powerup. I have no problem with the health powerup triggering, however when the hit particle is supposed to trigger it does, but it does not float and act is should/does in the particle editor. I've been at this for way longer than I should and I would appreciate any help that could be offered. Replying here would be great, but if you could contact me on Discord @ G-Rad#9144 it'd be greatly appreciated.

    Thank you!
     
  42. Oepfelkueche

    Oepfelkueche

    Joined:
    Jun 2, 2021
    Posts:
    1
    Hey Guys

    After days spent on the tutorial I finally made my way (almost) through it! =)
    I already overcome several hurdles, but now I'm definitely stuck with building the game.
    Everything up to "Build" works perfectly. I even get the message "Build completed with a result of 'Succeeded' in 12 seconds (11654 ms)", which makes me very confident.
    However, when I start the executable in the explorer, the game seems to start at first, but crashes before any graphics load. Tried several things, but I just can't get my game to start.
    Any help would be highly appreciated :)

    Thanks
     
  43. TheMikeDrop

    TheMikeDrop

    Joined:
    Mar 31, 2021
    Posts:
    2
    Figured it out. Had to download the assets differently.
     
  44. Chaotic_Squirrel

    Chaotic_Squirrel

    Joined:
    Aug 25, 2021
    Posts:
    1
    A problem I ran into is that you can't create a tile in unity 2020.3. It doesn't appear, even when I import the assets and tile.png.
     
  45. Valjuin

    Valjuin

    Joined:
    May 22, 2019
    Posts:
    481
    upload_2021-9-2_15-10-56.png
     
  46. coralinefischer

    coralinefischer

    Joined:
    Sep 20, 2021
    Posts:
    1
    I have the problem that when the robot walks from left to right, the cogs won't hit when thrown from left/right (from top/bottom it works). The collider boxes look like it should work with them. Any idea why it does not work?
     
    Barabulkaa likes this.
  47. vvidakovic-hhg

    vvidakovic-hhg

    Joined:
    Nov 5, 2021
    Posts:
    1
    I'm having the exact same problem in 2020.3.21f1. I tried removing the canvas and re-creating it following the same steps, but no luck.
     
  48. Barabulkaa

    Barabulkaa

    Joined:
    Nov 2, 2021
    Posts:
    4
    Hi,

    I am going through tutorial and its amazing, been really helpful to understand the code, its great to have a check the full code at the end of tutorials, its been really helpful.
    I have an issue with robot going into the fixed animation but with a smoke coming out, I am not sure what exactly i made a mistake with.

    Also Ruby does not seem to get damage from damageable objects. I do not see any evidence in the health bar so far...

    I get this in console, I wonder if this is related to the issues

    NullReferenceException: Object reference not set to an instance of an object
    UIHealthBar.SetValue (System.Single value) (at Assets/Scripts/UIHealthBar.cs:25)
    RubyController.ChangeHealth (System.Int32 amount) (at Assets/Scripts/RubyController.cs:88)
    Damageable.OnTriggerStay2D (UnityEngine.Collider2D other) (at Assets/Scripts/Damageable.cs:13)

    Would appreciate your help!
     
  49. Barabulkaa

    Barabulkaa

    Joined:
    Nov 2, 2021
    Posts:
    4
    So I figured out the issue with Robot animation - in Animator next to fixed there is a circle - that circle should not have a dot in it, I pressed on it by accident - that sorted the animation issue.

    I do have a different issue - when Ruby is throwing projectiles they do not seem to do anything to robot and also robot does not do any damage to Ruby either - they just pass eachother by.

    I checked the layers and objects do collide, i have that ticked, not sure where else is the issue could be.
     
  50. Barabulkaa

    Barabulkaa

    Joined:
    Nov 2, 2021
    Posts:
    4
    I have one more question - to which element of canvas the health bar script should be attached to? I am not sure I saw this in tutorial mentioned.