Last active
August 29, 2015 14:06
-
-
Save ihsanberahim/5873e07e91e96d72861c to your computer and use it in GitHub Desktop.
Add both the Js and the C# script to a same GameObject
This file contains 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 Unity.Engine; | |
using System.Collection; | |
public class csOne : MonoBehaviour | |
{ | |
public jsOne jsOneClass; | |
void Start() | |
{ | |
jsOneClass = GetComponent("jsOne"); | |
jsOneClass.say("Hai"); | |
} | |
public void say(string message) | |
{ | |
Debug.Log("From C#: "+message); | |
} | |
} | |
//DO NOT COPY THIS CREDITs | |
// author: ihsanberahim.com | |
// work for: fiction-labs.com | |
// work for: pkmedia.com.my |
This file contains 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
// GUIDES: | |
// | |
// + All Js files should be in "Standard Assets" | |
// Example: | |
// ..../Assets/Standard Assets/jsOne.js | |
// | |
// + comment "#pragma strict" or it will cause an error | |
//#pragma strict | |
var csOneClass; | |
function Start() | |
{ | |
csOneClass = GetComponent("csOne"); | |
csOneClass.say("hai"); | |
} | |
public function say(message) | |
{ | |
Debug.Log("From Js: "+message); | |
} | |
//DO NOT COPY THIS CREDITs | |
// author: ihsanberahim.com | |
// work for: fiction-labs.com | |
// work for: pkmedia.com.my |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment