Skip to content

Commit 9cdd8f8

Browse files
authored
Add back interactable shim (#746)
* Readd InterableShim, Please Remove after load test. * Add back BasisInteractableShim with Obsolete notice.
1 parent f70d835 commit 9cdd8f8

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

Basis/Packages/com.basis.shim/Shims/BasisInteractableShim.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Basis.Shims
99
{
10+
[Obsolete("Use the direct interactable component instead. This is a shim for the old system and should be removed at a later point.")]
1011
public class BasisInteractableShim : BasisInteractableObject // Need to remove at a later point.
1112
{
1213
// public BasisObjectSyncNetworking syncNetworking;

Basis/Packages/com.basis.shim/Shims/BasisShims.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,22 @@ public static BasisNetworkShim MakeNetworkable( MonoBehaviour mb )
3737

3838
return mb.gameObject.AddComponent<BasisNetworkShim>();
3939
}
40+
41+
[Obsolete("Use the direct interactable component instead. This is a shim for the old system and should be removed at a later point.")]
42+
public static BasisInteractableShim MakeInteractable( object o )
43+
{
44+
// Actually needs to be CilboxProxies.
45+
GameObject go = null;
46+
if( o is CilboxProxy )
47+
go = ((CilboxProxy)o).gameObject;
48+
else
49+
go = ((MonoBehaviour)o).gameObject;
50+
51+
BasisInteractableShim bi;
52+
if( go.TryGetComponent<BasisInteractableShim>( out bi ) ) return bi;
53+
54+
return go.AddComponent<BasisInteractableShim>();
55+
}
4056
}
4157

4258

0 commit comments

Comments
 (0)