Skip to content
This repository has been archived by the owner on Feb 13, 2018. It is now read-only.

A game object can only be in one layer. The layer needs to be in the range [0...31] #22

Open
XNBlank opened this issue Mar 29, 2016 · 3 comments

Comments

@XNBlank
Copy link

XNBlank commented Mar 29, 2016

Having issues with your Controller. I've set up a new project and imported the required package, and copied your scripts over from your demo, and this gets spammed in my console.

A game object can only be in one layer. The layer needs to be in the range [0...31]
UnityEngine.GameObject:set_layer(Int32)
SuperCharacterController:PushIgnoredColliders() (at Assets/SuperCharacterController/Core/SuperCharacterController.cs:465)
SuperCharacterController:ProbeGround(Int32) (at Assets/SuperCharacterController/Core/SuperCharacterController.cs:225)
SuperCharacterController:SingleUpdate() (at Assets/SuperCharacterController/Core/SuperCharacterController.cs:194)
SuperCharacterController:Update() (at Assets/SuperCharacterController/Core/SuperCharacterController.cs:158)

The character controller also falls through meshes I've imported or has jittery collision movment with them.

What my player controller looks like.

What the mesh looks like

and this is what happens. (After falling through it)

@lzurbriggen
Copy link

I'm pretty sure you didn't add the "TempCast"-layer. The SuperCharacterController.cs expects you to have a layer called "TempCast" to be able to ignore colliders.

private const string TemporaryLayer = "TempCast";

I'm not sure why this is hard-coded into the script, but adding it should solve your issue.

@XNBlank
Copy link
Author

XNBlank commented Mar 29, 2016

Oh I didn't see that. That fixed that issue. Player still falls through the platform after jumping though. Might be my collision though?

@IronWarrior
Copy link
Owner

Hmm. I've recreated your settings in my project without issue, which means it has to be some project setting, or some irregularity with your mesh. Would you be able to post the project here if it's not too large? Alternatively, a screenshot of the mesh might help. Try adding a box primitive with a mesh collider with the same settings to see if there's a problem. Or, push the pause button before pushing play in Unity (to let everything fully load; this avoids having a large deltaTime spike at the start. For production it's best to use a fixed timestep, however).

@Epicuri0us the reason it's hardcoded is that you cannot modify the layer manager at runtime (or the input manager...for reasons unknown). It would be much nicer to be able to just dynamically create a layer if it was missing, but I haven't yet found a better solution (I think I'll push an update that disables the controller if the layer is missing and prints out a nicer error message).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants