- Home /
Question by
BadAtCS · May 29 at 04:53 PM ·
c#charactercontroller
Unity Error CS0619 in custom character controller
Hey guys, I've a problem in the systembase of my charcter controller. It shows the error: error CS0619:
'BuildPhysicsWorld.GetOutputDependency()' is obsolete: 'GetOutputDependency() has been deprecated. Please call RegisterPhysicsRuntimeSystemReadWrite() or RegisterPhysicsRuntimeSystemReadOnly() in your system's OnStartRunning() to achieve the same effect. (RemovedAfter 2021-05-01)'
Here's my the part of the error:
protected override void OnUpdate()
{
var physicsWorldSystem = World.GetExistingSystem<Unity.Physics.Systems.BuildPhysicsWorld>();//get references before we can no longer access the main thread
CollisionWorld collisionWorld = physicsWorldSystem.PhysicsWorld.CollisionWorld;
EntityManager entityManager = EntityManager;
//set collisionWorld to readOnly with .WithReadOnly() so it does not throw errors
JobHandle controllerJob = Entities.WithReadOnly(collisionWorld).ForEach((ref CharacterControllerData characterController, ref Translation translation, ref DynamicBuffer<BounceNormals> bounceNormalsBuffer) =>
{
bounceNormalsBuffer.Clear();//reset buffer and convert to usable state
DynamicBuffer<float3> bounceNormals = bounceNormalsBuffer.Reinterpret<float3>();
Move(ref characterController, ref translation, ref bounceNormals, collisionWorld);//move
characterController.onGround = GetGrounded(bounceNormals, characterController);//update on ground
characterController.moveDelta = float3.zero;//reset moveDelta
}).ScheduleParallel(JobHandle.CombineDependencies(Dependency, physicsWorldSystem.GetOutputDependency()));//run on multiple cores
controllerJob.Complete();
}
Hope someone know how to fix it!
Comment
Your answer
