Forum rules - please read before posting.

2D Tutorial Player Sprite on Wrong Layer

I am following the tutorial on creating a 2D game. I just bought AC.

I just finished to the point where I made the MyPlayer a prefab and assigned it to the game editor settings.

I hit play like in the demo (without deleting the myplayer in the scene) and it doesn't look like in the video.

In the video the one in the scene goes away and you are left with one at the starting position and it looks great.

In my game I end up with 2 MyPlayer objects and the one that is being created by the game engine is behind the ParkGround object in the scene.

I think this is because the MyPlayer sprite and the ParkGround sprite are both set to Layer 0.

I didn't see anywhere in the tutorial so far where that gets changed.

I am using using Unity 4.6.2 and I think I am watching the latest tutorial. It has 8 game editor tabs.

Please advise.

Comments

  • edited May 2015
    Welcome to the forum, @Hotshot10101.

    The sorting order issue is sorted out just a little later on in the "Creating a Player" section - specifically at the 19:30 mark.

    Without seeing any screenshots of your game, I can't suggest much about the duplicate Players, other than to check your prefab has been tagged as "Player".  If that's the case, take a screenshot of your Player gameobject's Inspector, and the Settings Manager, and we'll see what needs to be done.
  • I thought I had tagged that, but you are right. That also makes the duplicate guy go away.

    Sorry to bother you. Thanks for the great tool. I look forward to sharing my adventure when I get it done.
  • I am going through the same tutorial.

    So far so good except I ran into the part where I am adding the bird. A window pops up saying that because of changes to Unity I have to put the hotspot and box collider on the sprite child and not the root object.

    I do this and the hotshot doesn't show wherever the circle collider is.

    It doesn't say what version of Unity. I have 4.6.2.

    Also if I put the hotspot and box collider on the root object in case I don't have the version you are talking about it doesn't work their either.

    Also, no matter what my player walks right through the bird. I thought the circle collider was supposed to prevent that.
  • The tutorial was made in Unity 4.6m but there aren't any version-specific features to be mindful of.

    I don't know quite what you mean by "the hotspot doesn't show" - do you mean in-game, or when editing?  If it doesn't show, check that your sprite child is on the Default layer - I may have to update that window with that info as well.  Unity made a change to their physics system which means that window unfortunately had to be added after the tutorial was made.

    Please take a couple of screenshots of both the Bird's root object Inspector, and the sprite child Inspector, and we'll be able to give more specific advice.
  • Thanks for getting back to me. I will try to clarify my questions.

    This is a picture of the Bird inspector:


    This is a picture of the Bird Animation Inspector:


    Here is a movie showing that when the player walks over the bird he goes right through it. I thought the circle collider on the bird was supposed to prevent that:


    Here is a movie showing that when the cursor is over the bird it doesn't show when also over the circle collider. This is what I mean. When the cursor is inside the hotspot collider, but NOT inside the circle you can see it. When the cursor is inside the hotspot collider AND the circle collider you can't see the cursor.


    One other thing. I assume that I have to change the name of the sprite animation because if you don't then the hotspot shows BirdAnim1_0 when you play the game. Is that correct?
  • No problem, I'm just sorry you're having these early frustrations.

    The bird's root object is currently on the Default layer.  Move it onto Ignore Raycast, and you'll no longer have the cursor error.  Only the clickable object (the sprite itself) should be on Default.

    By default, the Hotspot label will be the same as the object's name (in this case, BirdAnim1_0), but you can override this by entering a value into the Label (if not name) field.

    So long as you have a Default NavMesh defined, then yes - character evasion should be automatic.  This is a checkbox set in the NavMesh's Inspector, but is set to "On" by default.

    However, looking at your footage, it does look like the Player is adjusting his course ever so slightly, just not in the right place.  The system looks at the Bird's Circle Collider as the object to avoid, so make sure that it is centered around his feet - you can do this by adjusting the Circle Collider 2D component's Centre values.  If you have the Scene window open while testing, you'll be able to see the Player's intended Path as represented by a blue line.  You can use that to see for sure if the player is indeed avoiding the NPC.
  • You are correct on all counts. Time to go review the product because I am very satisfied and figure anything I encounter from here will be handled well.

    Thanks for telling me about the watching the scene while walking to see the path. This is VERY helpful. I had the game and scene windows docked together so they were always mutually exclusive.

    I put them side by side now and can see what the player is doing. Very nice!

    So I had to make the circle much bigger than expect to get it to really cause the player to walk past it in a way that looked right, but it is working as intended, so that is great!

    Don't worry about the issues I am having. I also have written an asset for the store (Bluetooth Low Energy component for iOS and Android) and I understand users who have some trouble getting things to work.

    Your asset is AWESOME. I am hoping to finally make a certain game that has taken me forever because of having to implement all the nitty gritty stuff. You asset should make it much easier.

    I warn you, however, that there are a few unique things about the game I will write that I will probably need your help with. Maybe not. I haven't gotten through all the tutorials and all the capabilities yet, so maybe you will handle it as is.

    Anyway, thanks again and talk to you soon.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.