Forum rules - please read before posting.

Spawning an Extra Copy of the Player and Not Recognizing Hotspots

Every time I test out my game, there are two copies of the player. One spawns at the defined player start 2D and moves/animates as it normally should. The other spawns where the player prefab was set up in the editor, doesn't move with the controls, and can be pushed around the area by the actual player. The actual player that can move is also unable to interact with any hotspots, and hundreds of copies of the same error message pop up whenever I run the game:

"Both a Player and a Hotspot Detector on that Player are required for Hotspots to be detected by 'Player Vicinity'
-> AC debug logger
UnityEngine.Debug:LogWarning(Object, Object)
AC.ACDebug:LogWarning(Object, Object) (at Assets/AdventureCreator/Scripts/Static/ACDebug.cs:33)
AC.PlayerInteraction:CheckForHotspots() (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:293)
AC.PlayerInteraction:ContextSensitiveClick() (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:590)
AC.PlayerInteraction:HandleInteractionMenu() (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:199)
AC.PlayerInteraction:UpdateInteraction() (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:126)
AC.StateHandler:Update() (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:205)"

This message also appears in console and may explain why there are two copies of the player:

"Local Player My new Player found in scene 1.1.1. This is not allowed when Player Switching is enabled - in this mode, Players can only be spawned in.
-> AC debug logger
UnityEngine.Debug:LogWarning(Object, Object)
AC.ACDebug:LogWarning(Object, Object) (at Assets/AdventureCreator/Scripts/Static/ACDebug.cs:33)
AC.KickStarter:PreparePlayer() (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:1149)
AC.KickStarter:Initialise() (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:1119)
AC.MultiSceneChecker:Awake() (at Assets/AdventureCreator/Scripts/Game engine/MultiSceneChecker.cs:43)"

These two messages may also be related:

"The HotspotDetector's layer, Default, is the same used by Hotspots, and will prevent Hotspots from being properly detected. It should be moved to the Ignore Raycast layer.
-> AC debug logger
UnityEngine.Debug:LogWarning(Object, Object)
AC.ACDebug:LogWarning(Object, Object) (at Assets/AdventureCreator/Scripts/Static/ACDebug.cs:33)
AC.DetectHotspots:Start() (at Assets/AdventureCreator/Scripts/Object/DetectHotspots.cs:48)"

"The Player 'My new Player' has a Hotspot Detector assigned, but it is a direct child of a 2D root. Either parent it to the 'sprite child' instead, or check 'Turn root object in 3D space?' in the Player Inspector.
-> AC debug logger
UnityEngine.Debug:LogWarning(Object, Object)
AC.ACDebug:LogWarning(Object, Object) (at Assets/AdventureCreator/Scripts/Static/ACDebug.cs:33)
AC.Player:Awake() (at Assets/AdventureCreator/Scripts/Character/Player.cs:95)"

I got to this point after following the official youtube tutorial for 2D games. I am very new to Unity and Adventure Creator. Thank you for any help you can offer.

Comments

  • Welcome to the community, @AetherS.

    "Local Player My new Player found in scene 1.1.1. This is not allowed when Player Switching is enabled - in this mode, Players can only be spawned in."

    This is the key one. If you enable Player-switching in the Settings Manager, local Players - that is, those present in the scene file - are not possible. This is because AC handles the addition/removal of Players to the scene automatically in this mode.

    Is "My new Player" present in the saved scene file, outside of Play mode? You'll need to remove it if Player-switching is allowed.

  • Thank you. That fixed it immediately :)

  • Related to this, I have custom move speeds and mobile sorting order tracking adjusted on my player prefab on a per-scene basis. If AC spawns my player in, I'm seemingly unable to change these parameters per scene. Does your Player overhaul work allow for such things to every work again? Or is there perhaps a work around? - I switch players, but only between scenes.

  • It shouldn't be that the updated player-switching workflow should prevent it, but your custom script may need to be adjusted.

    If you just want to affect the current Player, you can reference them at any time with:

    AC.KickStarter.player
    

    To give more specific help I'd need to see the code you're working with. Can you share further details?

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.