IronWarrior / SuperCharacterController

Unity custom character controller

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

XNBlank opened this issue · comments

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)

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.

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

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).