Forum rules - please read before posting.

Tutorial Unity adventure game - questions

edited April 2020 in Technical Q&A

Hey there,
On about minute 33 there is a talk on how to create a new PlayerStart, and use it when the player comes from another scene. It looks pretty easy solution, you create new PlayerStart, rename it to something like PlayerStartFromAnotherScene, and change in PlayerStart(script) Choose scene by: set on name, Previous scene to: set on SecurityRoom. Also Camera settings, Camera on Start is set to NavCam1, Fade in on start is on, and fade speed to 0.5. That is it. But it do not work. When I came from the other scene player is starting on the same position. What am I missing?!
Here is a link to a screenshot:

Edit: The very same thing is working on the other way around, when comes from Market to sec. room.


  • That's essentially the workflow - though the GameObject's name is unimportant.

    The screenshot shows it's correctly configured, but not the problem. Where exactly is the Player starting, and what of the camera?

    Are you getting any relevant messages in the Console?

  • Hey again Cris, thank you for you valuable help! The player is spawned exactly over the PlayerStart marker (however we do try to spawn it over the PlayerStart_FromSec (from security room) marker. PlayerStart have no camera in camera settings, PlayerStart_FromSec uses NavCam1 (GameCamera). I am getting some messages in the console, how relevant I am not sure. Here is a link with the messages:

  • edited April 2020

    I have find out that maybe accidentally I have placed two PlayerStart markers. I have deleted the one with no camera. Now I am getting only this message: GameObject NavCam 1 was not saved because it does not have a 'Constant ID' script - please exit Play mode and attach one to it.
    However player still spawn on PlayerStart, and not PalyerStart from security room marker (no matter if I start market scene or enter market scene from the security room).

  • Ok I added the Constant ID script to NavCam on both scenes, and now it works!

  • Does the Player now spawn in the correct spot, or is it just that the warnings disappear? I'm a little confused about how many PlayerStarts are still in your scene.

    On the topic of Constant ID components - this is how AC "flags up" objects in your scene that require their data to be included in save game files. See the Manual's "Saving scene objects" chapter for more on this.

  • Hi Chris,
    Yes. It does spawn at the PlayerStart marker (when I run the game from the Market scene), and when you come from security room it does start on the marker, that is near the door. Waring messages are all gone. It work as it should.
    I have two PlayerStart objects, there were three, but that was a mistake, made by me. Please note that I am kind of new to this field. My questions, and actions could be a bit lame. For example I was going to complain that I do not see the yellow box of the hotpots, and this did drive my crazy for a while, until I find out that you will need to have "gizmos" on, in order to see that box.
    About "Constant ID components" Now as you mention it, I remember that you can automatically add these (explained by the end of the 2d tutorial) if, of course, "Constant ID components" is equivalent to "Save components", but I will check the manual, however I do not understand how this affect my player start. As you notice it is was correctly configured.

  • "Constant ID components" is equivalent to "Save components"

    Save components are made up of two types: Constant ID and Remember.

    Remember components are used to save specific data about an object (e.g. it's position), while ConstantID components are used to save a reference to an object (e.g. make a note of this camera if its active when saving).

    I do not understand how this affect my player start. As you notice it is was correctly configured.

    While it's good practice to have the component attached, you're right that it shouldn't have been necessary. It may be that some there was something at work here, but I can't tell from the above what it was.

  • edited April 2020

    OK I have pinned my self into some trouble at the point where actions are combined, and after a lot of back and forward the mess was getting bigger, and bigger. So a decision has been made to start all over again. Now I get extremely stupid situation where the character is falling out of the scene when I run the scene. Basically I have opened the two scenes, deleted the content that we will not use, created the character prefab, and set up the navigation, when I run with the gizmos on, I can see even my click are getting registered, and the blue trajectory to them, but the character is falling out of the scene, and just keeps falling. I have run these first 20 minutes, of the tutorial, like 5 times always with the same result, and I am really in front of a wall here. Any advice will be greatly appreciated!

  • I haven't done this tutorial, but it sounds like you have not setup collision boxes on in your scene yet. Collision Boxes stop things like Players falling through them.

    I'd also recommend going through the other tutorials on Chris' Youtube channel first as I believe they might be simplier to start with.

  • edited April 2020

    Hey Jack, thank you! But I am doing the tutorials as recommended. 2d first, this one second. There is nothing about collision boxes in the tutorial, they should come with the scene from Unity. I will check to see if I will be able to add one.

  • This is for the "Recreating Unity's Adventure game" tutorial?

    It's possible Unity may have made changes to the source file, which the tutorial depends on. In any case, if the character relies on gravity then they will indeed fall unless a floor collider is configured.

    This can be as simple as an invisible Plane, scaled up to cover up the playable area, and placed on the Ignore Raycast layer to prevent conflict with the NavMesh.

    Alternatiely, you can also prevent the Player from responding to gravity - either by checking Ignore gravity? in their Player component, or by removing their Rigidbody.

  • edited April 2020

    Hey Cirs, thank you for your continuous support!
    Yes, all questions here are related to this tutorial. The plane did not work. I could not also make the Player not to relay on gravity (Player->Rigidbody->Use Gravity?), removing the RigidBody did the job. However I manage to localize the issue with the Players capsule collider. As far is I understand we need this to be a trigger, in order to switch between the Security room, and Market scenes, but it seems that as a trigger it do not function any more as a collider. So I left this as a trigger, and added another capsule collider. It works now (with gravity on), but is this a good solution? Should I expect any issues from having 2 capsule colliders, one of them a trigger. This is also very strange, because I am doing this tutorial for a second time, and did not have this issue the first time.

  • A Collider should respond to the Trigger object regardless of whether its own "Is Trigger" field is checked. You should be able to get away with just one.

    By the "Ignore gravity?" option, I was referring to the one in the Player component - not the Rigidbody. The former will override the latter.

    Alternatively, you can replace all your Rigidbody and Collider components with a single Character Controller - AC will respond to this as well.

  • Thank you Cris! I will choose the option with one collider, that has "Is Trigger" turned off.

  • edited April 2020

    Whoa! Just done it! The whole tutorial! It took me a lot of time and effort, but it was worth it:) Thank you Cris. I will go on to the 3d game tutorial.

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.