Unity Community |

Hi JD,
Javascript is same as C#. Just do
Code:
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.
Last edited by JD-; 05-16-2012 at 06:54 AM.
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.
About Simian Squared Recent The Other Brothers Physynth Recommended Shaders+Framework
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?
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.
Did you clear the console?
About Simian Squared Recent The Other Brothers Physynth Recommended Shaders+Framework
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).
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.
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, 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, 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 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 simjeanny,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");
}
}
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
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.
Hi LuckyMouse,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
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.
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
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.
thank jwu!![]()