1,351 questions
-1
votes
1
answer
69
views
Need assistance with script which makes cube change color depending on the mouse state (up, down, over, etc.)
I'm trying to create a UnityScript. When the player hovers their mouse over a cube, it goes green. If the player does OnMouseDown, the color will go red. If the Player does OnMouseUp, the color will ...
0
votes
1
answer
75
views
What is the correct syntax to use LINQ SUM in UnityScript
Hello I'm trying to figure out the correct syntax for getting the sum from a class list using LINQ in unityscript
var totalCount: int;
class munsters {
var beast: String;
var min: int = 1;
var max:...
-2
votes
1
answer
313
views
MissingMethodException : UnityEngine.GameObject.setActive [closed]
I have added the below script to the NPC. on clicking on to the NPC the MessageBox (Panel in Canvas) should appear. But the MessageBox.setActive() part is not working. Below is the code.
import ...
2
votes
1
answer
2k
views
Why is it SO Hard to Just Mute a Sound in Unity?
I have spent all day looking for a solution to this problem, and I simply can't find one. Using JavaScript in Unity 3D, I have a script where I want to play a sound when the player's velocity on the X ...
0
votes
1
answer
89
views
Unity Javascript transform object not able to go in
var Distance;
var Target = transform;
var lookAtDistance = 25.0;
var attackRange = 15.0;
var moveSpeed = 5.0;
var Damping = 6.0;
function Update ()
{
Distance = Vector3.Distance(Target.position, ...
0
votes
1
answer
1k
views
Unity How to turn off a gameObject's Mesh Collider when a collison on another object is done?
On my unity project I have encountered a problem I want to collide with an object then I want to turn on the mesh collider of an other gameObject this is my code now...
#pragma strict
private var ...
0
votes
0
answers
42
views
Unity3D: How would I go by saving a list/ array of strings/ objects/ prefabs? [duplicate]
For my game in Unity 2017.2, I am trying to save the prefabs that I just bought in the games store (not IAP) and load them to a garage type scene.
I was first thinking I could get the name of the ...
0
votes
1
answer
799
views
Teleporting Character From Edge to Edge of the Screen
I am trying to Teleport a character from a Edge of the screen to the contrary edge I'm using this:
var pos: Vector3 = Camera.main.WorldToViewportPoint(transform.position);
if (pos.x < 0.0) ...
1
vote
2
answers
10k
views
How can I switch between shaders in real time?
The problem is that I have two shaders. If I change between the shaders while the game is running it will not take effect. Only if I start the game with a current shader it will use the shader but not ...
0
votes
1
answer
78
views
GameObject activates too soon
EDIT
So it's in here, of this I have no doubt, but why? NextOne.active = true; is firing off regardless of whether the action button is being pressed.
if(Input.GetButtonDown("Action") && ...
1
vote
3
answers
10k
views
unity - how two objects with rigidbody can pass through each other?
(I saw a question like mine, but my case is different)
I explain:
I have a 2d game(side view), where players going around and hit each other with weapons like sword or hammer. I set ground on a ...
0
votes
1
answer
68
views
class extend variable scope in unityscript
Let me be more specific here: This is used in Unity 2017 so the syntax they are using is this:
class CameraMotionBlurEditor extends Editor
{
var preview : SerializedProperty;
var ...
-1
votes
1
answer
2k
views
Unity3D input.acceleration
I want to move an object with acceleration input in unity:
if (...)
transform.translate(vector2.right*speed);
else if (...)
transform.translate(vector2.left*speed);
I don't know what the conditions ...
0
votes
1
answer
176
views
Assets/shadow.js(9,19): BCE0019: 'active' is not a member of 'UnityEngine.Transform'
#pragma strict
var target : Transform;
function Start () {
}
function Update () {
if(target.active){
gameObject.transform.position.x= target.transform.position.x;
gameObject....
1
vote
1
answer
216
views
Unity3d character move with arrows keys from point to point
I have a waypoints script that I apply to an object. For example, on a character that goes from point to point and stops for a certain time and then continues to walk. How can I modify the code if I ...