Unity Community


Page 58 of 89 FirstFirst ... 848565758596068 ... LastLast
Results 1,141 to 1,160 of 1772

  1. Posts
    33
    Quote Originally Posted by jwu View Post
    Hi JD,

    Javascript is same as C#. Just do

    Code:  
    1. var sampleText:exSpriteFont = gameObject.GetComponent.<exSpriteFont>();
    2. sampleText.text = "This is a test. Test. Test. Test.";

    jwu, that worked, but I'm getting the following red warning.

    "ArgumentException: You are not allowed to call get_gameObject when declaring a variable."

    What do I do about that?

    ***** Edit *****

    Found the answer. Changed the code to the following, and assigned the fontSpriteObject in the inspector.

    Code:  
    1. var sampleText:exSpriteFont;
    2.  
    3.  
    4. function Update () {
    5.    
    6.     sampleText.text = "This is a test. Test. Test. Test.";
    7.    
    8. }
    Last edited by JD-; 05-16-2012 at 06:54 AM.

  2. Super Moderator
    Location
    Great Britain
    Posts
    9,683
    It's faster to do:

    var sampleText:exSpriteFont = gameObject.GetComponent(exSpriteFont);

    ...in unity js. I know this 100% for fact, since 3.4. Eric did a lot of tests.
    Currently working with Sony on our new
    PS4 and Vita game in Unity!

    This post is not representative of Simian Squared Ltd


  3. Posts
    33
    Now, how do I create a fontSprite object entirely from JavaScript? Can someone show me where this is documented, or share the code with me?


  4. Posts
    33
    Quote Originally Posted by hippocoder View Post
    It's faster to do:

    var sampleText:exSpriteFont = gameObject.GetComponent(exSpriteFont);

    ...in unity js. I know this 100% for fact, since 3.4. Eric did a lot of tests.
    When I do this, it gives me the following error. Although, it works anyway with the error, but I don't want the error.

    "ArgumentException: You are not allowed to call get_gameObject when declaring a variable."

    I'm using Unity 3.5.2
    Last edited by JD-; 05-16-2012 at 07:15 AM. Reason: Declaring which version of Unity I'm using.

  5. Super Moderator
    Location
    Great Britain
    Posts
    9,683
    Did you clear the console?
    Currently working with Sony on our new
    PS4 and Vita game in Unity!

    This post is not representative of Simian Squared Ltd


  6. Posts
    33
    Quote Originally Posted by hippocoder View Post
    Did you clear the console?
    Yes


  7. Posts
    33
    Is it possible to use ex2d sprites as a HUD for a First Person Controller in a 3D environment?


  8. Posts
    704
    Quote Originally Posted by JD- View Post
    Is it possible to use ex2d sprites as a HUD for a First Person Controller in a 3D environment?
    Sure, we did that before.

    About the javascript questions, I think most of them are about correcting syntax writing. There is no different in using ex2D for C# or Javascript indeed, so what we show in the documentation is equally the same for Javascript by converting the script under the syntax Unity provide for Javascript( I prefer call it UnityScript).


  9. Posts
    19
    Hi ! Please kindly help me.
    - I have create sprite animation by ex2d.I have 2 animation and i select Wrapmod as LOOP.
    -I want when i press key down (right/left), it runs animation right/left otherwise it runs idle animation, But when i press key down of right/left, it is not run animation all frame, it just run animation at frame 1.If i release pressing key down right/left, It runs animation full frame.

    this is my script:

    var sprite_ani : exSpriteAnimation;

    function Start(){
    sprite_ani = Getcomponent("exSpriteAnimation");
    sprite_ani.Play("idle_ani");
    }
    function Update(){
    if(Input.GetButtonDown("Horizontal") && Input.GetAxis("Horizontal") >0){
    sprite_ani.Play("walk_right");
    }
    if(Input.GetButtonDown("Horizontal") && Input.GetAxis("Horizontal") <0){
    sprite_ani.Play("walk_left");
    }
    else{
    sprite_ani.Play("idle");
    }
    }


    Last edited by simjeanny; 05-16-2012 at 09:41 PM.


  10. Posts
    19
    Hi ! Please kindly help me.
    - I have create sprite animation by ex2d.I have 2 animation and i select Wrapmod as LOOP.
    -I want when i press key down (right/left), it runs animation right/left otherwise it runs idle animation, But when i press key down of right/left, it is not run animation all frame, it just run animation at frame 1.If i release pressing key down right/left, It runs animation full frame.

    this is my script:

    var sprite_ani : exSpriteAnimation;

    function Start(){
    sprite_ani = Getcomponent("exSpriteAnimation");
    sprite_ani.Play("idle_ani");
    }
    function Update(){
    if(Input.GetButtonDown("Horizontal") && Input.GetAxis("Horizontal") >0){
    sprite_ani.Play("walk_right");
    }
    if(Input.GetButtonDown("Horizontal") && Input.GetAxis("Horizontal") <0){
    sprite_ani.Play("walk_left");
    }
    else{
    sprite_ani.Play("idle");
    }
    }


  11. Posts
    12
    Hi, jwu.

    I have a problem- periodically resets the flag - "Read/Write Enabled" on my atlas.
    It usually occurs after the opening scene, when it changed a different developer.
    I have several atlases - very annoying always include these flags.

    Best regards.


  12. Location
    Rotterdam NL, San Francisco USA, Hong Kong, China
    Posts
    66

    build Atlas by script

    Hi, I'm trying to do the dynamic atlas build by script, i tried the script from earlier post
    http://forum.unity3d.com/threads/101...l=1#post671437

    I got a lot of error messages, is it only working with older verion and not compatible with newest version of ex2D?

    Actually i just need the Atlas Build function, so i removed all the CreateAnimClips codes. Finally I got single line of error:

    Assets/AutoPipeline.cs(79,9): error CS0246: The type or namespace name `exAtlasInfo' could not be found. Are you missing a using directive or an assembly reference?

    Btw, I tried the script from wiki also http://www.ex-dev.com/ex2d/wiki/doku...sets_by_script, and I got the same error.

    The error have something to do "exAtlasInfo", any idea?

    Do you have an updated and working example code for create atlas by script?

    I'm using ex2D 1.2.5, unity pro 3.5.2f2 on MacOSX Lion


  13. Location
    Rotterdam NL, San Francisco USA, Hong Kong, China
    Posts
    66
    Hi jwu,

    Does ex2D compatible with Flash build?

    After I installed the ex2D, even a simple scene ( just a Main Camera, Sphere, Directional light) and I can Not build the Flash SWF.

    I'm using ex2D 1.2.5, unity pro 3.5.2f2 on MacOSX Lion


  14. Posts
    33
    Quote Originally Posted by jwu View Post
    Sure, we did that before..
    How? Where? Is there a demo? Tutorial? Documentation? I need to be able to do it, but I don't know how?


  15. Posts
    704
    Quote Originally Posted by simjeanny View Post
    Hi ! Please kindly help me.
    - I have create sprite animation by ex2d.I have 2 animation and i select Wrapmod as LOOP.
    -I want when i press key down (right/left), it runs animation right/left otherwise it runs idle animation, But when i press key down of right/left, it is not run animation all frame, it just run animation at frame 1.If i release pressing key down right/left, It runs animation full frame.

    this is my script:

    var sprite_ani : exSpriteAnimation;

    function Start(){
    sprite_ani = Getcomponent("exSpriteAnimation");
    sprite_ani.Play("idle_ani");
    }
    function Update(){
    if(Input.GetButtonDown("Horizontal") && Input.GetAxis("Horizontal") >0){
    sprite_ani.Play("walk_right");
    }
    if(Input.GetButtonDown("Horizontal") && Input.GetAxis("Horizontal") <0){
    sprite_ani.Play("walk_left");
    }
    else{
    sprite_ani.Play("idle");
    }
    }
    Hi simjeanny,

    Because spriteAnim.Play(name) will rewind the animation and play it from start. So you can not do this in Update every frame. If you wish, you can simply do it as

    Code:  
    1. if ( spriteAnim.IsPlaying("run") == false )
    2.     spriteAnim.Play("run");


  16. Posts
    704
    Quote Originally Posted by vpin View Post
    Hi, jwu.

    I have a problem- periodically resets the flag - "Read/Write Enabled" on my atlas.
    It usually occurs after the opening scene, when it changed a different developer.
    I have several atlases - very annoying always include these flags.

    Best regards.
    Hi vpin,

    This problem should relate with the PostImportProcessor. I think when others open the project and ex2D detects the changes and then it will re-import some atlas and apply the default setting of it. I doubt I should design the texture info including atlas settings in ex2D v2.0 to completely solve the problem.

    I'm not sure if I guess the right thing and the right issue, can you explain more so that I can help to reproduce the problem locally.


  17. Posts
    704
    Quote Originally Posted by LuckyMouse View Post
    Hi, I'm trying to do the dynamic atlas build by script, i tried the script from earlier post
    http://forum.unity3d.com/threads/101...l=1#post671437

    I got a lot of error messages, is it only working with older verion and not compatible with newest version of ex2D?

    Actually i just need the Atlas Build function, so i removed all the CreateAnimClips codes. Finally I got single line of error:

    Assets/AutoPipeline.cs(79,9): error CS0246: The type or namespace name `exAtlasInfo' could not be found. Are you missing a using directive or an assembly reference?

    Btw, I tried the script from wiki also http://www.ex-dev.com/ex2d/wiki/doku...sets_by_script, and I got the same error.

    The error have something to do "exAtlasInfo", any idea?

    Do you have an updated and working example code for create atlas by script?

    I'm using ex2D 1.2.5, unity pro 3.5.2f2 on MacOSX Lion
    Hi LuckyMouse,

    The problem is you running the script in Runtime not in Editor. Please put the script to Editor folder so that the exAtlasInfo can be import. Because create atlas is an Editor operation, you can't do it in the Runtime.


  18. Posts
    704
    Quote Originally Posted by LuckyMouse View Post
    Hi jwu,

    Does ex2D compatible with Flash build?

    After I installed the ex2D, even a simple scene ( just a Main Camera, Sphere, Directional light) and I can Not build the Flash SWF.

    I'm using ex2D 1.2.5, unity pro 3.5.2f2 on MacOSX Lion
    Hi LuckyMouse,

    We currently provide Flash build by Email request. Because I only do limit support to Flash version, it is not fully tested but only compile successfully and can export project to Flash. (performance and picture quality not tested yet).

    You can send E-Mail asking a Flash build version. ==> KarasAya[at]gmail.com


  19. Posts
    704
    Quote Originally Posted by JD- View Post
    How? Where? Is there a demo? Tutorial? Documentation? I need to be able to do it, but I don't know how?
    Hi JD-,

    There is lots of way in implement HUD. For a 3D game, you can put your sprite in the very front layer or writing a shader with the Overlay+1 queue.

    After that you can calculate the screen position to put your sprite at the right place, or you can just put your sprite under your camera as child node and place it in a proper offset.

    Then you can add collision box to your sprite and let them respond the touch/mouse cick script. If you just want to show some status of your game, write a script and grab the info and put it in the scene.

    You also can use 2nd camera which will render the HUD sprites in a different pass, and just put the depth order higher than the first camera.

    All this documentation can be found in Unity's Web Site, they are just part of Unity3D, ex2D here do nothing but show the sprite.


Page 58 of 89 FirstFirst ... 848565758596068 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •