![]() |
Convert from unity 2021 to 2022 - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html) +--- Thread: Convert from unity 2021 to 2022 (/thread-3814.html) Pages:
1
2
|
Convert from unity 2021 to 2022 - lacasrac - 19-03-2023 unity 2021: public void SetSimplices(int[] simplices, SimplexCounts counts) { this.simplices.CopyFrom(simplices); how to convert this line to 2022? Assets\Obi\Scripts\Common\Backends\Burst\Solver\BurstSolverImpl.cs(314,37): error CS1503: Argument 1: cannot convert from 'int[]' to 'in Unity.Collections.NativeArray<int>' RE: Convert from unity 2021 to 2022 - josemendez - 19-03-2023 (19-03-2023, 05:06 PM)lacasrac Wrote: unity 2021: Hi! You can use CopyFromNBC from the Unity.Collections.NotBurstCompatible namespace, since CopyFrom has been removed in the latest Collections package version: https://docs.unity3d.com/Packages/com.unity.collections@1.0/api/Unity.Collections.NotBurstCompatible.Extensions.html kind regards, RE: Convert from unity 2021 to 2022 - lacasrac - 21-03-2023 (19-03-2023, 06:17 PM)josemendez Wrote: Hi! one more thing: private void UpdateKinematicVelocities(float stepTime) { //TODO this freezes unity FPS, so I commented out, lot of WARNINGS /* // differentiate positions/orientations to get our own velocites for kinematic objects. // when calling Physics.Simulate, MovePosition/Rotation do not work correctly. Also useful for animations. if (unityRigidbody.isKinematic) { // differentiate positions to obtain linear velocity: unityRigidbody.velocity = (transform.position - prevPosition) / stepTime; // differentiate rotations to obtain angular velocity: var delta = transform.rotation * Quaternion.Inverse(prevRotation); unityRigidbody.angularVelocity = new Vector3(delta.x, delta.y, delta.z) * 2.0f / stepTime; }*/ prevPosition = transform.position; prevRotation = transform.rotation; } unity 2022 throw a lot of warnings (like you can't update the velocity on a kinematic body), and FPS goes to 15-30 FPS in the editor from 80-90 so I had to comment that out. Is it okay? Or I need this one? RE: Convert from unity 2021 to 2022 - josemendez - 21-03-2023 Seems like Unity 2022 does no longer support setting the velocity of a kinematic rigidbody and will throw a warning when doing so. Commenting this piece of code will disable CCD for kinematic rigidbodies, which depending on what you're doing might be a bummer. Will work around this and get you an alternative asap. kind regards, RE: Convert from unity 2021 to 2022 - lacasrac - 29-03-2023 (21-03-2023, 09:07 AM)josemendez Wrote: Seems like Unity 2022 does no longer support setting the velocity of a kinematic rigidbody and will throw a warning when doing so. ok thanks, any news? RE: Convert from unity 2021 to 2022 - josemendez - 29-03-2023 (29-03-2023, 07:12 AM)lacasrac Wrote: ok thanks, any news? Sorry, I forgot about this. ![]() You can find the modified scripts attached. Replace the scripts at: Assets/Obi/Scripts/Common/Collisions/ObiRigidbody.cs and Assets/Obi/Scripts/Common/DataStructures/ColliderRigidbody.cs with the ones attached, that should get rid of the warning. The workaround is basically to store our own linear/angular velocities for kinematic rigidbodies, instead of relying on Unity for this. Should you encounter any issue with these modified scripts, please let me know. kind regards, RE: Convert from unity 2021 to 2022 - lacasrac - 29-03-2023 (29-03-2023, 09:59 AM)josemendez Wrote: Sorry, I forgot about this. thanks this is working, Compilation was requested for method `Unity.Jobs.IJobExtensions+JobStruct`1[[Obi.ConstraintSorter+CountSortPerFirstParticleJob`1[[Obi.BurstContact, Obi, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], Obi, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null::Execute(Obi.ConstraintSorter+CountSortPerFirstParticleJob`1[[Obi.BurstContact, Obi, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]&, Obi, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null|System.IntPtr, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|System.IntPtr, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|Unity.Jobs.LowLevel.Unsafe.JobRanges&, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null|System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)` but it is not a known Burst entry point. This may be because the [BurstCompile] method is defined in a generic class, and the generic class is not instantiated with concrete types anywhere in your code. Compilation was requested for method `Unity.Jobs.IJobParallelForExtensions+ParallelForJobStruct`1[[Obi.ConstraintSorter+SortSubArraysJob`1[[Obi.BurstContact, Obi, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], Obi, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null::Execute(Obi.ConstraintSorter+SortSubArraysJob`1[[Obi.BurstContact, Obi, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]&, Obi, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null|System.IntPtr, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|System.IntPtr, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|Unity.Jobs.LowLevel.Unsafe.JobRanges&, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null|System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)` but it is not a known Burst entry point. This may be because the [BurstCompile] method is defined in a generic class, and the generic class is not instantiated with concrete types anywhere in your code. Compilation was requested for method `Unity.Jobs.IJobExtensions+JobStruct`1[[Obi.ConstraintBatcher+BatchContactsJob`1[[Obi.ContactProvider, Obi, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], Obi, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null::Execute(Obi.ConstraintBatcher+BatchContactsJob`1[[Obi.ContactProvider, Obi, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]&, Obi, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null|System.IntPtr, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|System.IntPtr, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|Unity.Jobs.LowLevel.Unsafe.JobRanges&, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null|System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)` but it is not a known Burst entry point. This may be because the [BurstCompile] method is defined in a generic class, and the generic class is not instantiated with concrete types anywhere in your code. Compilation was requested for method `Unity.Jobs.IJobExtensions+JobStruct`1[[Obi.ConstraintBatcher+BatchContactsJob`1[[Obi.FluidInteractionProvider, Obi, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], Obi, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null::Execute(Obi.ConstraintBatcher+BatchContactsJob`1[[Obi.FluidInteractionProvider, Obi, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]&, Obi, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null|System.IntPtr, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|System.IntPtr, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|Unity.Jobs.LowLevel.Unsafe.JobRanges&, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null|System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)` but it is not a known Burst entry point. This may be because the [BurstCompile] method is defined in a generic class, and the generic class is not instantiated with concrete types anywhere in your code. and this warnings? ![]() RE: Convert from unity 2021 to 2022 - josemendez - 29-03-2023 (29-03-2023, 12:49 PM)lacasrac Wrote: thanks this is working, Hi! Newer Burst versions broke generic job compilation (in line with Unity's policy of breaking 3 features for every new one they add). This was addressed in Obi 6.5.1, in case you're using an older version I'd suggest updating to 6.5.1 since the fix/patch is not trivial to apply. In case you're already using 6.5.1, may I ask which version of the Burst package you're currently using? kind regards, RE: Convert from unity 2021 to 2022 - lacasrac - 29-03-2023 (29-03-2023, 01:20 PM)josemendez Wrote: Hi! obi 6.5.1 burst 1.8.3 I try soon with 1.8.4 RE: Convert from unity 2021 to 2022 - josemendez - 29-03-2023 (29-03-2023, 01:38 PM)lacasrac Wrote: obi 6.5.1 That's strange, could you check whether the file located at Obi/Assets/Obi/Scripts/Common/Backends/Burst/DataStructures/ConstraintBatcher/ConstraintSorter.cs defines ConstraintSorter as: Code: public class ConstraintSorter<T> where T : struct, IConstraint (roughly line 12 in the file). (29-03-2023, 01:38 PM)lacasrac Wrote: burst 1.8.3 Latest Burst version that didn't exhibit this issue was 1.6. I'm not sure what the status is for 1.8.4. |