The unityscript tag has no wiki summary.
0
votes
0answers
13 views
save and view snapshot image from android device
I'm having a problem with saving image into an android device this is what i did
My java class :
package com.test.app;
import com.unity3d.player.UnityPlayerActivity;
import android.os.Bundle;
...
3
votes
1answer
63 views
Cannot use DLL in my Unity project
I'm pretty new in Unity and i'm trying to write reusable code to use across multiple "project". So I wrote this class to POST and GET highscore via WebRequest. I compiled the project to a DLL and ...
0
votes
0answers
19 views
front camera not working in unity 3d android
i have this peace of code :
public string deviceName;
WebCamTexture webCameraTexture;
public Text txt;
private WebCamDevice[] devices;
private WebCamTexture webCam;
// Use this for initialization
...
1
vote
1answer
43 views
Importing code from unityscripts
To encourage code reuse- i want to import methods and classes defined in my core unityscripts to be imported into other unityscripts. How do i go about this?
Note: An answer here seems too ...
0
votes
1answer
49 views
Can Java be used for developing games for Android in Unity3D [duplicate]
I only know Java Programming Language and no other. Can I develop games for Android in Unity3D using Java?
0
votes
2answers
46 views
Checking if object passed between two other objects
I have a three objects (strikers), lets say red, green and blue.
When I apply force to the green object I want to check if it has passed between red and blue or not. See the image below for an ...
0
votes
1answer
46 views
Screen record in unity3d
How to do screen record in unity? I want to record my screen(gameplay) during my running game. That should be play/stop , replay , save that recording on locally from device, open/load from my device ...
0
votes
0answers
42 views
how to create a responsive scene
I'm currently creating a 2d android,IOS game using unity engine ,I'm testing the game on a nexus 5,Iphone 5s device,Everything till now is working fine and i am pretty happy with the result ,but the ...
0
votes
1answer
84 views
Crop a texture procedurally
Is there a way to crop a texture having a list of triangles which represent the part to be kept?
For instance, I have a rectangular texture and I want to obtain a texture shaped by the triangle list I ...
0
votes
1answer
50 views
Visual studio and Unity does not sync
I'm pretty new to Game Development world. I'm using Unity 3D (4.6 - Latest version I think) and Visual Studio to code the script and something when I edit the script un VS 2013 and go back to Unity ...
0
votes
0answers
71 views
Adding Player Movement and Firing on Touch Input (Unity)
I am having many problems with this. I am a new game developer and I am using a Unity tutorial. But I want to add touch input for movement and a touch button for firing the weapon. How can I do this? ...
2
votes
2answers
143 views
2D Boat controlling physics
I'm working on a top-down 2D boat game with Unity3D. I couldn't able to understand how to implement physics of rudder controlling. My physics knowledge is not enough to think how rudder dynamics work. ...
5
votes
1answer
116 views
Multiple Scripts versus single script
I have (methink) a simple question regarding attaching scripts to a GameObject.
Is there any performance loss if I attach a script to a GameObject for each action to be performed (such as movement, ...
1
vote
1answer
165 views
How can I merge multiple sprite into one sprite or texture using Unity3d?
I have an avatar generator where someone can create a custom avatar with layers superimposed.
And in order to reuse this image multiple times, i want to merge all layers in one image.
Is there any way ...
0
votes
0answers
73 views
How to play video in Unity Free on Android (may be using external open source libraries like ffmpeg)
I need to play video file in my game and I am using Unity Free. The solution with rendering images with a certain delay is not suitable for me, because my video file is made from over than 300 images. ...
0
votes
1answer
86 views
Play continuous music when swapping between multiple scene in Unity3d
I have the following scenario
Main menu scene containing a gameobject with an audio source component
An about us scene
gameObject script :
using UnityEngine;
using System.Collections;
public ...
0
votes
1answer
81 views
how to disable sprite renderer and mesh renderer in unity 3D programetically?
In my game i have a empty gameobject that has a sprite and a textmesh as child I want to access the child (sprite and the text mesh) and turn off the sprite renderer and mesh renderer of the sprite ...
1
vote
1answer
123 views
Resetting a level in unity when exiting to main menu
I have a pause screen in my game having two buttons : resume game and exit to main menu
The main menu have only 1 button wish is play,
when i click on exit to main menu the main menu level is ...
1
vote
2answers
55 views
Unity access method from separate script
I'm learning Unity3D and I'm practising accessing game object scripts from other objects. For the most part I've got it down, but I've run into a weird issue causing a NullPointerException.
I've set ...
2
votes
1answer
109 views
Unity's StartCoroutine funtionality inside a .NET Library and outside a MonoBehaviour
This code is used in a MonoBehaviour script in my current code:
// a simple WWW post
WWW www = new WWW(this.Url, bytes);
StartCoroutine(WaitForRequest(www));
}
// simple handler for the ...
-1
votes
1answer
46 views
Float increment give wrong result [closed]
I found something weird with my unity code :
public class heroesscript : MonoBehaviour {
float counter = 0;
void FixedUpdate()
{
counter += 0.02f;
print (counter);
...
-1
votes
1answer
87 views
Yeild waitForSeconds(5.0) is not working
I am trying to call another function continuously from my Update() function. So, I have used yield WaitForSeconds(5.0); but, the it stops for the first 5 seconds and it does not stop the next time it ...
0
votes
1answer
67 views
Why does this code not update my object's position?
I am trying to move the object in my frame in Time.deltaTime. I have not taken care the speed yet but the problem is, the object is almost at position (0,0) after I have multiplied the x & y axis ...
0
votes
0answers
49 views
How to embed UnityScript for scripting in Unity3D?
It is useful to have parts of your game being scriptable. Many people (especially outside of Unity) are using LUA for that job. As UnityScript (as with Boo or C#) is a first class citizen why not use ...
1
vote
0answers
53 views
How to initialize once for all a static field of a custom editor in unity
I have a custom editor wich has a static field.
Suppose you have a static field of type MyObject:
public class myEditor : Editor {
...
private static MyObject myObj;
...
}
I'd like to ...
0
votes
0answers
116 views
Unity3D C#: How to resize an inputfield according the content which is set dynamic
I've got an InputField where the text is filled in upon getting a string back from the server. We can debug the entire text so we receive it correctly. However the text is too long to fit in our ...
0
votes
1answer
74 views
Unity3D : Unity fails to detect null objects
im instantiating an object which is gonna play the background music for my game. On the Awake() function I check if there is a gameobject with the tag "MusicPlayer" on it, and if there isn't any I ...
1
vote
2answers
135 views
Unity Raycast shoots right through some objects
I made a melee combat system for my game. The code looks like this:
var hit:RaycastHit;
if(Physics.Raycast(transform.position,transform.forward,hit)) {
if(hit.distance<=2.0) {
...
0
votes
1answer
27 views
Destroy a single list member
im trying to destroy a single game object using the following script but it destroys all of them , not the ones I want. I want to destroy the ones that the transform that holds this script collides ...
3
votes
1answer
293 views
Change unity physics engine speed
Is there a simple way to change the speed* of unity's physics engine like in the game SuperHot?
Any script language is ok but javascript is preferred.
*I am not sure if speed is the correct term.
0
votes
1answer
105 views
Where should I put code if I want it to run automatically?
I'm new to programming and I found an animation script that has code that is called in the OnMouseDown event, when the user clicks the object. I'd like the code to run automatically, instead of ...
2
votes
3answers
163 views
How do I define a required component on a Unity game object?
I have a script that expected the game object to have a Terrain component.
Is there an attribute I can add (or some other way) which will prevent a designer from adding my ...
0
votes
0answers
49 views
How to control animationClip though scripting or button pressed
I am stuck in my project designing Game Menu in unity. I am using NGUI plugin free version. I created image button and animated in animation view. It made animationclip and added in animator ...
0
votes
1answer
50 views
How to increase the rotation of a quaternion by a percentage of X % in a Unity script?
There is a simple way to increase the rotation described by a quaternion by a percentage X?
Sorry, but in the documentation of Unity3D I found nothing and I have a poor knowledge on the topic.
0
votes
2answers
233 views
StartCoroutine function inside TriggerOnEnter2D not working - unity + kinect
So i'm using Kinect with unity to track user's hand movements, and let the user's hand act as a mouse, I have written the code to detect a collision between a button (sprite object) and the hand ...
0
votes
0answers
28 views
Drag object on the XZ plane
I wrote a script to drag an object on the XZ plane. It works good when the object is close to the camera's position.
So here is the code:
using UnityEngine;
using System.Collections;
public class ...
-1
votes
4answers
137 views
Scripting vs Programming [closed]
How does using Scripting and calling functions of scripting API differ from programming using C++ in UDK or Unity?in scripting we use the scripting API to interact with the engine and use functions ...
0
votes
1answer
187 views
NGUI Texture Background Font of Sprite
I am new to Game Development and using NGUI plugin free version. There are few sprite images in my game. I made them prefab and instantiated at runtime. then I created NGUI Texture and Made it ...
0
votes
0answers
30 views
iTween.LookTo works only when the boolean gets changed
im trying to rotate an object when the player gets too close to it but it only rotates when the player leaves leaves the range for 0.5 seconds or less. It does the same if i use ontriggerenter and ...
0
votes
1answer
170 views
Random Object in Array
I am using Unity. I have created eight different types of objects, stored in an array, and I am displaying them on the scene in a grid pattern with random order.
The first four objects in the array ...
-1
votes
1answer
55 views
How to increase player Lifes count
I am new in Unity Game Development. I am designing infinite game using C# scripting.
There are many cubes in my game scene. if single cube is hit by player, He gets 100 points.
if same color, two ...
0
votes
1answer
70 views
How to write a unity script to observe the position of a game object (during scene creation)
I want to write a simple Unity script to be notified when a game object is moved, during the creation of the scene.
More precisly, I want to write a Unity script that can recognize when the user ...
-1
votes
1answer
271 views
Unity 3D: Raycasting for gun hits
I am having trouble understanding raycast hits in Unity3D.
I am trying to create an FPS game, so I have a gun, bullets and so on.
My script for the bullets is:
var Bullet : Transform;
var Spawn ...
0
votes
1answer
163 views
Raycast doesn't point on the right direction
The raycast line im rendering is acting weird, it doesn't point where I want it to.
I want it to point from the yellow object to the selected one but it draws it at another position.
Here is my ...
5
votes
1answer
149 views
How can I copy an asset folder programatically depending upon a constant?
I have a Unity project in which I have 200 games and some 350 scenes. Now I want to make separate builds for each game. All my assets are present in Assets/IgnoredAssets/ABC folder. To include these ...
3
votes
1answer
536 views
Unity 3d 4.6b New GUI system doesn't take touch when already a touch event is occurring in 3d scene
I know this is beta version but..
I have a Canvas->Button which works fine when I tap it normally.
I have a joystick in my scene which is drawn by separate camera other than mainCamera.
now, while ...
1
vote
2answers
179 views
Why should I use getcomponent?
I have already referred the animator by using the statement,
Animator anim;
But,What is the use of getcomponent in awake() function.What happens without it.
1
vote
1answer
533 views
What does Quaternion.Lookrotation do?
I have this code,
if(Physics.Raycast(camRay,out floorHit,camRayLength,floorMask))
{
Vector3 playerToMouse = floorHit.point-transform.position;
playerToMouse.y=0f;
Quaternion newRotation ...
0
votes
1answer
79 views
How to make it two seconds for Time.time?
var targetscript : Diamond;
var red : Color;
var orange : Color;
function Start () {
gameObject.camera.backgroundColor = red;
}
function Update () {
if (targetscript.score > 4) {
...
0
votes
1answer
42 views
Align SpriteText position
i have this function which aligns text.
static function AlignTxt(obj : GameObject, txtAnchor : SpriteText.Anchor_Pos,
txtAlign : SpriteText.Alignment_Type)
{
...