Skip to content

Instantly share code, notes, and snippets.

@ihsanberahim
Last active August 29, 2015 14:06
Show Gist options
  • Save ihsanberahim/5873e07e91e96d72861c to your computer and use it in GitHub Desktop.
Save ihsanberahim/5873e07e91e96d72861c to your computer and use it in GitHub Desktop.
Add both the Js and the C# script to a same GameObject
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
// 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