1

So I just created a new project to mess around with visual scripting, ECS and DOTS but I'm having some issues to get some of the unity physics stuff to work VisualScriptingPhysics.cs it says that it has Assemble reference missing but I have check the docs and it has all the references it would need to work what am I missing

I'm getting 2 errors in the console

Library\PackageCache\com.unity.visualscripting.entities@0.4.0-preview.1\Runtime\VisualScriptingPhysics.cs(94,58): error CS0246: The type or namespace name 'ICollisionEventsJob' could not be found (are you missing a using directive or an assembly reference?)

Library\PackageCache\com.unity.visualscripting.entities@0.4.0-preview.1\Runtime\VisualScriptingPhysics.cs(94,39): error CS0246: The type or namespace name 'ITriggerEventsJob' could not be found (are you missing a using directive or an assembly reference?)

witch is referencing this struct CollectCollisionsJob : ITriggerEventsJob, ICollisionEventsJob witch is in VisualScriptingPhysics.cs a part of Visual Scripting package for it to be compatible with unity physics and the reference that it says it needs in the doc is Unity.Physics witch is at the top of the code would there be any way to fix this manual please let me know

full code for the file that is throwing error keep in mind that this is part of a package and not my code let me know if its something I can fix or do I have to wait till unity update their package

#if VS_DOTS_PHYSICS_EXISTS
using System;
using System.Collections.Generic;
using Runtime;
using Unity.Collections;
using Unity.Entities;
using Unity.Jobs;
using Unity.Physics;
using Unity.Physics.Systems;
using UnityEngine.VisualScripting;

namespace VisualScripting.Physics
{
    public static class VisualScriptingPhysics
    {
        [Hidden]
        struct VisualScriptingTriggerEvent : IVisualScriptingEvent {}

        [Hidden]
        struct VisualScriptingCollisionEvent : IVisualScriptingEvent {}

        public static readonly ulong TriggerEventId = VisualScriptingEventUtility.ComputeEventTypeHash<VisualScriptingTriggerEvent>();
        public static readonly ulong CollisionEventId = VisualScriptingEventUtility.ComputeEventTypeHash<VisualScriptingCollisionEvent>();

        [Flags]
        public enum EventType
        {
            Collision = 1,
            Trigger = 2
        }

        public static JobHandle SetupCollisionTriggerData(EntityManager entityManager, int frame,
            ref NativeHashMap<(Entity, Entity), CollisionTriggerData> nativeMultiHashMap, EntityQuery q,
            EventType collisionMode, JobHandle inputDeps)
        {
            var calculateEntityCount = q.CalculateEntityCount();
            if (nativeMultiHashMap.Capacity < calculateEntityCount)
                nativeMultiHashMap.Capacity = calculateEntityCount * 2; // Register the collision with both EntityA and EntityB as a key

            var job = new CollectCollisionsJob
            {
                Frame = frame,
                CollInfos = nativeMultiHashMap,
            };

            var buildPhysicsWorldSystem = entityManager.World.GetOrCreateSystem<BuildPhysicsWorld>();
            var stepPhysicsWorldSystem = entityManager.World.GetOrCreateSystem<StepPhysicsWorld>();
            switch (collisionMode)
            {
                case EventType.Collision:
                    job.EventType = EventType.Collision;
                    return ICollisionEventJobExtensions
                        .Schedule(job, stepPhysicsWorldSystem.Simulation, ref buildPhysicsWorldSystem.PhysicsWorld, inputDeps);
                case EventType.Trigger:
                    job.EventType = EventType.Trigger;
                    return ITriggerEventJobExtensions
                        .Schedule(job, stepPhysicsWorldSystem.Simulation, ref buildPhysicsWorldSystem.PhysicsWorld, inputDeps);
                default:
                    throw new NotImplementedException();
            }
        }

        public struct CollisionTriggerData : IEquatable<CollisionTriggerData>
        {
            public Entity Other;
            public int Frame;
            public CollisionState State;
            public EventType EventType;

            public bool Equals(CollisionTriggerData other)
            {
                return Other.Equals(other.Other);
            }

            public override bool Equals(object obj)
            {
                return obj is CollisionTriggerData other && Equals(other);
            }

            public override int GetHashCode()
            {
                return Other.GetHashCode();
            }
        }

        public enum CollisionState
        {
            None,
            Enter,
            Stay,
            Exit,
        }

        struct CollectCollisionsJob : ITriggerEventsJob, ICollisionEventsJob
        {
            public int Frame;
            public NativeHashMap<(Entity, Entity), CollisionTriggerData> CollInfos;
            public EventType EventType;

            public void Execute(TriggerEvent triggerEvent)
            {
                var ea = triggerEvent.EntityA;
                var eb = triggerEvent.EntityB;
                Process(ea, eb);
            }

            public void Execute(CollisionEvent collisionEvent)
            {
                var ea = collisionEvent.EntityA;
                var eb = collisionEvent.EntityB;
                Process(ea, eb);
            }

            void Process(Entity ea, Entity eb)
            {
                RegisterCollisionData(ea, eb);
                RegisterCollisionData(eb, ea);
            }

            void RegisterCollisionData(Entity self, Entity other)
            {
                bool found = false;
                if (CollInfos.TryGetValue((self, other), out var collInfo))
                {
                    found = true;
                    if (collInfo.Frame == Frame - 1) // had a collision during the prev frame
                    {
                        collInfo.State = CollisionState.Stay;
                        collInfo.Frame = Frame;
                        CollInfos[(self, other)] = collInfo;
                    }
                }

                // new collision
                if (!found)
                {
                    CollInfos.Add((self, other), new CollisionTriggerData
                    {
                        Other = other,
                        Frame = Frame,
                        State = CollisionState.Enter,
                        EventType = EventType
                    });
                }
            }
        }
    }
}
#endif

here is all the packages I have installed with the version and date they were updated i have tried to change the version of a different package but keep getting the same error

Burst Version 1.3.3 - June 26, 2020

Castle Core Version 1.0.1 - June 13, 2019

Collections Version 0.11.0-preview.17 - July 22, 2020

Custom NUnit Version 1.0.0 - April 03, 2019

Entities Version 0.13.0-preview.24 - July 22, 2020

Graph Tools Foundation Version 0.3.0-preview.1 - July 31, 2020

Havok Physics for Unity Version 0.3.1-preview - July 28, 2020

Hybrid Renderer Version 0.7.0-preview.24 - July 22, 2020

Input System Version 1.0.0 - April 29, 2020

Jobs Version 0.4.0-preview.18 - July 22, 2020

Mathematics Version 1.1.0 - July 11, 2019

Mono Cecil Version 0.1.5-preview - April 03, 2019

Moq Version 1.0.0 - June 13, 2019

Newtonsoft Json Version 2.0.0-preview - December 13, 2019

Performance testing API Version 2.2.0-preview - May 27, 2020

Platforms Version 0.6.0-preview.1 - July 07, 2020

Properties Version 1.3.1-preview - June 17, 2020

Properties UI Version 1.3.1-preview - June 18, 2020

Scriptable Build Pipeline Version 1.6.4-preview - February 11, 2020

Searcher Version 4.0.9 - November 11, 2019

Serialization Version 1.3.1-preview - June 18, 2020

Test Framework Version 1.1.16 - July 27, 2020

TextMeshPro Version 3.0.1 - July 27, 2020

Timeline Version 1.3.4 - June 11, 2020

Unity Collaborate Version 1.3.8 - June 12, 2020

Unity Physics Version 0.4.1-preview - July 27, 2020

Unity UI Version 1.0.0 - August 05, 2020

Visual Scripting ECS Version 0.4.0-preview.1 - July 31, 2020

Visual Studio Code Editor Version 1.2.1 - May 20, 2020

Visual Studio Editor Version 2.0.2 - June 02, 2020

4

1 回答 1

0

Havok Physics for Unity 破坏了所有我将它恢复到旧版本以及 Visual Scripting ECS 和 Unity Physics 女巫最终使用过时的东西吐出关于它的不同错误所以我最终只是删除了 Havok Physics 并在我更新后修复了所有内容再次休息,所以我想我会等到他们更新 Havok 看看这个问题是否已解决

于 2020-08-18T08:58:58.640 回答