Search Unity

How to call a javascript file fom c#?

Discussion in 'Android' started by Milan_cool, Feb 23, 2011.

  1. Milan_cool

    Milan_cool

    Joined:
    Jan 24, 2011
    Posts:
    22
    Hii,
    i am developing animation using javascript.But i want to call from c#.is dere any solution?please help me?
     
  2. kamicazer

    kamicazer

    Joined:
    Oct 29, 2010
    Posts:
    32
  3. Caliber-Mengsk

    Caliber-Mengsk

    Joined:
    Mar 24, 2010
    Posts:
    689
    Just like passing variables between scripts should work.
    gameObject.GetComponent("C#scriptname").FunctionName
    gameObject.GetComponent("C#scriptname").VariableName

    Just make sure to set the functions or variables you want to get to public.

    EDIT: Note though, I am saying this as a unity developer in general, not an android one, so if it doesn't work as simple as that, sorry. XD
     
  4. Milan_cool

    Milan_cool

    Joined:
    Jan 24, 2011
    Posts:
    22
    thankx for dat.I have already apppiled dat.But problem is dat i havenot a defult animation in my .obj 3d model.So when i assigned gameobject for dat i found a nullrefence exception.so can we add animation clip to the .obj 3d model so dat i assign gameObject for dat and it willnot give nullRefernceException.can u please help me.