Created
April 12, 2020 22:16
-
-
Save mattbajorek/c2ce5891f37d6d80e293567c39ef604a to your computer and use it in GitHub Desktop.
Example calling script
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 Plugins.NativeCalculations; | |
using UnityEngine; | |
public class CallingExample : MonoBehaviour | |
{ | |
// Start is called before the first frame update | |
void Start() | |
{ | |
try | |
{ | |
Debug.Log("CallingExample - started"); | |
var rectangleHeight = 3; | |
var rectangleWidth = 4; | |
var syncResults = NativeCalculations.PerformSyncCalculation(rectangleHeight, rectangleWidth); | |
Debug.Log($"Sync results: diagonal = {syncResults.diagonal}, perimeter = {syncResults.perimeter}, area = {syncResults.area}"); | |
NativeCalculations.PerformAsyncCalculation(rectangleHeight, rectangleWidth, (asyncResults) => | |
{ | |
Debug.Log($"Async results: diagonal = {asyncResults.diagonal}, perimeter = {asyncResults.perimeter}, area = {asyncResults.area}"); | |
}); | |
} | |
catch (Exception exception) | |
{ | |
Debug.LogError(exception); | |
} | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment