This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
using UnityEngine; | |
namespace Plugins.NativeCalculations | |
{ | |
... | |
public static class NativeCalculations | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
using UnityEngine; | |
namespace Plugins.NativeCalculations | |
{ | |
... | |
public static class NativeCalculations | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
using UnityEngine; | |
namespace Plugins.NativeCalculations | |
{ | |
[Serializable] | |
public class CalculationResults | |
{ | |
public float diagonal; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.values(groupedNumberDataWithGeneric).forEach(numberArray => { | |
numberArray.forEach(num => { | |
console.log(num * 2); | |
}); | |
}); | |
Object.values(groupedStringDataWithGeneric).forEach(stringArray => { | |
stringArray.forEach(str => { | |
console.log(str.length); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from 'lodash'; | |
const numberData: number[] = [1, 1, 2, 2, 3]; | |
const stringData: string[] = ['a', 'a', 'b', 'b', 'c']; | |
// Works properly and keeps type | |
function groupDataWithGeneric<T>(data: T[]): _.Dictionary<T[]> { | |
return _.groupBy(data); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.values(groupedNumberData).forEach(numberArray => { | |
numberArray.forEach(num => { | |
// This won't work without a type assert or type check | |
console.log((num as number) * 2); | |
}); | |
}); | |
Object.values(groupedStringData).forEach(stringArray => { | |
stringArray.forEach(str => { | |
// This won't work without a type assert or type check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from "lodash"; | |
const numberData: number[] = [1, 1, 2, 2, 3]; | |
const stringData: string[] = ["a", "a", "b", "b", "c"]; | |
// Works but is not optimal | |
function groupData( | |
data: Array<number | string> | |
): _.Dictionary<Array<number | string>> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "math.h" | |
char const *GAME_OBJECT = "PluginBridge"; | |
@interface Utility : NSObject | |
@end | |
@implementation Utility | |
+ (NSString *)dictionaryToJson:(NSDictionary *)dictionary { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using UnityEditor.Callbacks; | |
using UnityEditor.iOS.Xcode; | |
using System.IO; | |
using System.Linq; | |
public class BuildPostProcessor | |
{ | |
[PostProcessBuild] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.nativecalculations; | |
import android.app.Activity; | |
import android.util.Log; | |
import com.google.gson.Gson; | |
import com.unity3d.player.UnityPlayer; | |
class CalculationResults | |
{ |