I was using PolySpatialWindowManagerAccess.entityForIdentifier for accessing entities on Swift side. Unfortunately I cannot use this after upgrading PolySpatial to ‘1.3.9’ to ‘2.0.4’.
Error: “Type PolySpatialWindowManagerAccess has no member entityForIdentifier”
I searched all classes and methods under PolySpatialRealityKit namespace but no luck.
How can I access corresponding entity on Swift?
It looks like this function (and its corresponding one, identifierForEntity) was accidentally removed in development of PolySpatial 2.X. We’ll make a note to add it back in a future version, although it might be changed to return an array of Entities, since technically there will be one Entity for each volume.
Unfortunately, I don’t think there’s a workaround that we can provide at present.
Hi @AndrzejUnity Thanks for the quick answer. Actually I was using it with an ID retrieved from the csharp api PolySpatialObjectUtils.GetPolySpatialIdentifier(gameObject).
I don’t understand why it should return array of entities? I just want to get the Entity in Swift side corresponding to the GameObject in Unity.
With the support that we added for multiple volumes in 2.X, each volume will (or can) have an Entity for a given GameObject. For example, you can have multiple bounded volume cameras that overlap but render to different windows, which means that you’ll have several views of the same GameObject, each with their own Entity.
At any rate, we’re going to be keeping the current API and adding a new function:
public static func entitiesForUnityInstanceId(id: Int32) -> [Entity]
If you use the old API (entityForIdentifier) with the value from PolySpatialObjectUtils.GetPolySpatialIdentifier, you’ll get the Entity from the first volume.
Totally forgot about multiple volumes
Thanks for the detailed explanation!