Skip to content

Commit cc4f9fa

Browse files
committed
update comments
1 parent 3e9a7ab commit cc4f9fa

File tree

4 files changed

+12
-15
lines changed

4 files changed

+12
-15
lines changed

UnityProject/Assets/Plugins/iOS/NativeState.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ struct NativeState {
1212
typedef void (*SetNativeStateCallback)(struct NativeState nextState);
1313

1414
@protocol SetsNativeState
15-
/* This is the critical function pointer that will be used to send state from Swift to Unity.
16-
Encapsulation within a protocol will let us take advantage of Swift's didSet property observer. */
15+
/* Function pointer that will be used to send state from Swift to Unity.
16+
Encapsulation within a protocol lets us take advantage of Swift's didSet property observer. */
1717
@property (nullable) SetNativeStateCallback setNativeState;
1818
@end
1919

UnityProject/Assets/Plugins/iOS/NativeState.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
id<SetsNativeState> nativeStateSetter;
44

5-
// Called from Swift. Can we hide this from the C# dll import?
5+
// Called from Swift. Can we hide this from the C# DllImport()?
66
void RegisterNativeStateSetter(id<SetsNativeState> setter) {
77
nativeStateSetter = setter;
88
}
99

10-
/* Called from Unity. Interop marshals the argument from a C# delegate to a C function pointer.
10+
/* Called from Unity. Interop marshals argument from C# delegate to C function pointer.
1111
See section on marshalling delegates:
1212
learn.microsoft.com/en-us/dotnet/framework/interop/default-marshalling-behavior */
1313
void OnSetNativeState(SetNativeStateCallback callback) {

UnityProject/Assets/Scripts/NativeStateManager.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
using System.ComponentModel;
2-
31
/* Support init only setters. See section on record
42
support: docs.unity3d.com/Manual/CSharpCompiler.html */
53
namespace System.Runtime.CompilerServices
64
{
7-
[EditorBrowsable(EditorBrowsableState.Never)]
85
internal class IsExternalInit{}
96
}
107

11-
// Should match the NativeState struct in Plugins/iOS/NativeState.h
8+
// Should match NativeState struct in Plugins/iOS/NativeState.h
129
public readonly struct NativeState
1310
{
1411
public float scale { get; init; }
@@ -23,15 +20,15 @@ public static class NativeStateManager
2320
{
2421
public static NativeState State { get; private set; }
2522

26-
// Should match the SetNativeStateCallback typedef in Plugins/iOS/NativeState.h
23+
// Should match SetNativeStateCallback typedef in Plugins/iOS/NativeState.h
2724
private delegate void SetNativeStateCallback(NativeState nextState);
2825

29-
/* Imported from Plugins/iOS/NativeState.m to pass an instance of
26+
/* Imported from Plugins/iOS/NativeState.m to pass instance of
3027
SetNativeStateCallback to C. See section on using delegates: docs.unity3d.com/Manual/PluginsForIOS.html */
3128
[System.Runtime.InteropServices.DllImport("__Internal")]
3229
private static extern void OnSetNativeState(SetNativeStateCallback callback);
3330

34-
/* Reverse P/Invoke wrapped method to set the state value. iOS is an AOT platform hence the decorator.
31+
/* Reverse P/Invoke wrapped method to set state value. iOS is an AOT platform hence the decorator.
3532
See section on calling managed methods from native code: docs.unity3d.com/Manual/ScriptingRestrictions.html */
3633
[AOT.MonoPInvokeCallback(typeof(SetNativeStateCallback))]
3734
private static void SetState(NativeState nextState) { State = nextState; }

UnityProject/Assets/Scripts/RootBehavior.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ void Update()
2020
Texture2D nextMainTexture = null;
2121
if (state.texture != System.IntPtr.Zero) {
2222
/* In practice it looks like our values for width and height are ignored.
23-
It probably determines correct values from the native MTLTexture's own properties.
24-
Documentation still insists that we pass the correct width and height values, so we will.*/
23+
It probably determines correct values from native MTLTexture's own properties.
24+
Documentation still insists that we pass correct width and height values, so we will. */
2525
nextMainTexture = Texture2D.CreateExternalTexture(state.textureWidth, state.textureHeight, TextureFormat.BGRA32, false, false, state.texture);
2626
}
2727

@@ -37,14 +37,14 @@ It probably determines correct values from the native MTLTexture's own propertie
3737

3838
if (state.visible)
3939
{
40-
// Rotate in the same direciton as the touch delta
40+
// Rotate in same direciton as touch delta
4141
Vector2 delta = touch.deltaPosition * 0.1f;
4242
cube.transform.Rotate(delta.y, -delta.x, 0, Space.World);
4343
}
4444

4545
if (touchIndicator is null)
4646
{
47-
// Create a touch indicator
47+
// Create touch indicator
4848
touchIndicator = new GameObject("Touch Indicator");
4949
touchIndicator.AddComponent<Image>().sprite = sprite;
5050
touchIndicator.transform.SetParent(canvas.transform);

0 commit comments

Comments
 (0)