Quantcast
Channel: Latest Questions by Meriodoc
Viewing all articles
Browse latest Browse all 20

How do i pass a value from a javascript to a c# script

$
0
0
I would really appreciate it if someone can assist me with this. My playerScript is in javascript. When player scores, I would like to pass the score to a C# script...that can then update my high scores C# scene(script). Here is a java script snippet. I'm also going to attach the complete javascript below the snippet...in case someone can help me to change the javascript to c#. Thanks in advance. if(Physics.Raycast(ray, hit, rayDistance)) { if(hit.transform.tag == objectTag1) { var enemyScript = hit.transform.GetComponent(scriptEnemy); // Reduce the number each click enemyScript.numberOfClicks -= 1; // condition to check that the object is at zero before adding the points to the score if(enemyScript.numberOfClicks <= 0) { //Add points to our overall score score += enemyScript.enemyPoints; // HERE is where i want to add one point to the score keeping C# script (scriptSceneManager) // scriptSceneManager.AddScore(1);

Viewing all articles
Browse latest Browse all 20

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>