A type of programming, often meant to be easier to learn than more "traditional" programming. Scripting is often used when performance is less important than ease of use. Examples of scripting languages are: Javascript, Lua, Perl, Python, and PHP. Scripting languages are often interpreted instead of ...

learn more… | top users | synonyms

4
votes
2answers
59 views

Which parts of game should belong to engine and which should belong to scripts?

Often, the game is splitted into engine code (i.e. C++) and scripts (i.e. Lua). The question is which parts / modules of game code should typically belong to engine, and wchich should belong ...
1
vote
1answer
41 views

How to Slice the external Spritesheet programmatically by using C# in Unity

I have a sprite sheet like this: I am using Unity Engine to develope my game. I would like to load this external spritesheet outside and slice it as Grid type programmatically instead of using ...
0
votes
2answers
45 views

Unity - Determine direction vector3 from a point in space and an angle in eulers

I have a ball positioned as Vector3(x, x, x). I was able to get the direction of the ball to the mouse clicked position with: Code (csharp): Vector3 direction = Direction (clickPos2 - startPos); ...
0
votes
1answer
42 views

Player launches into air when hitting steep slopes

I've been debugging an issue where when my player is moving forward at high speeds (I have configurable movement modes for an overview/overwatch mode) if they are in walk mode and hit a steep slope ...
0
votes
2answers
67 views

Player in Spaceship

I want to realize space game on Unity3d engine. There are some huge spaceships in the void. So, I want players flying in space in weightlessness, but when they go inside any spaceship, they will be ...
1
vote
1answer
20 views

Unity 5.x - Editor only constructor/initilization event

I have three scripts: Level - Represents a Tile Based level. LevelEditor - Custom Editor for Level. Tile - A non monobehaviour class for storing tile information. Level contains an array of Tiles ...
16
votes
4answers
2k views

What can I do to avoid one-off flags and checks throughout my code?

Consider a card game, such as Hearthstone. There are hundreds of cards that do a wide variety of things, some of which are unique even to a single card! For instance, there is a card (called ...
0
votes
1answer
33 views

Scripting: to block or not to block

Context: I'm making a little "program your robot army" sort of game in Java in which the player writes Lua scripts (which are then run by LuaJ) to program their robots to do stuff. So far there are ...
0
votes
0answers
46 views

How would I go about creating my own SDK to allow users to develop their own addon mods?

I am looking into developing a game, but I am very interested in the more abstract concepts such as modding. I would like to know, or get linked to information detailing the prerequisites, ...
0
votes
3answers
64 views

Calling and functions/methods from different Classes in Unity

I am learning some of the basics with Unity and am running into calling/sending code to a different script. For example, the code below is a basic menu of options. I have a different Scene set up in ...
0
votes
1answer
31 views

Kinematic equations script fail

I added the kinematic equations to my code and now none of it works. I get the error rigidbody.torque assign attempt for 'Enemy' is not valid. Input torque is { 0.000000, NaN, 0.000000 }. ...
0
votes
1answer
32 views

Audio slider doesn't change value

For some reason, my slider and audio resets back to 0 when I stop and play the game after I changed the value. Here is the code, I can't spot anything wrong with it: using UnityEngine; using ...
1
vote
1answer
56 views

How do I use playerprefs to make ui slider keep the sound settings?

I have not use playerprefs before, I want to know how to keep the change of the audio when the player change it throughout the game.
0
votes
1answer
19 views

Error BCE0043,BCE0044 and UCE001 [closed]

I got my code right here: #pragma strict var hSliderValue : float = 0.0; function OnGUI(){ hSliderValue = GUI.HorizontalSlider (Rect (25, 25, 100, 30),hSliderValue, 00, 1.0); ...
-1
votes
1answer
46 views

How is the relationship between Scripts and Objects in Unity?

If I don't attach the Script to the Object, will be the code able to "see" the object? When I need to manipulate (such as enabled() or a transform()) two or more Objects, do I need to attach the ...
0
votes
1answer
43 views

Unity gravity not effecting everyone like it should

so My problem is a bit weird. I have a model that will not fall at the correct speed. She falls incredibly slowly. This is the only script attached to her, and I did the "Scale to large" test by ...
4
votes
3answers
153 views

Single Switch Script vs Multiple Scripts

Would it be better to have one script that switches or have multiple scripts with each with their own function? In example, Lets say I am making a powerup script. Option 1: Create a single powerup ...
1
vote
1answer
41 views

Unable to achieve two finger panning

I'm looking to achieve a two finger smooth pan system in my project. However, the code below does not work, any interaction with the screen doesn't change to position of the camera. I am unsure where ...
0
votes
1answer
76 views

Unable to stop navmeshagent for rotation before moving

I'm trying to get the NavMeshAgent to rotate before calculating a path and proceed walking. I stumbled upon a thread that said this can be done by manually rotating the object first. However, I am ...
0
votes
3answers
124 views

Health bar - calculating health bar's position from percentage

I'm making a simple health bar in Unity 3D. Health bar UI is made from images. I'm having a problem with setting bar's position based on health percentage. Here's a script part: percentHealth = ...
0
votes
2answers
28 views

Getting unit to complete rotation before moving?

I've been trying to get a unit in my project to move in a fashion similiar to that of modern MOBA games. However, I am faced with the issue of the unit moving before the rotation is completed and the ...
0
votes
1answer
26 views

Unable to get object to rotate to looked position?

I'm trying to get an object to smoothly rotate towards a clicked point in my terrain. However, my code only yields jittery movements in the other direction. Any help will be greatly appreciated. ...
1
vote
0answers
48 views

How do I add scripting logic to my dialogue tree? [closed]

I'm creating 2D RPG game and I want to implement branching dialogue system which can also change player stats, add items and so on. Also I want to implement conditions for some answers so player ...
1
vote
1answer
285 views

How do I Rigidbody.AddForce(Vector3) in Unreal Engine?

I am coming from the Unity Engine, and trying to get my feet wet with Unreal Engine 4.8.x. I want to add a one-time force to an object. To accomplish this in Unity 5, I would use: void Start(){ ...
0
votes
1answer
113 views

How do I make the ui button to move my character? [closed]

How do I make my character move left,right and jump when click ui buttons using this code? using UnityEngine; using System.Collections; public class Player: MonoBehaviour { public float maxspeed = ...
0
votes
0answers
22 views

How do I make Ground Check stop rotating with the character when it rotate? [duplicate]

How do I make my character routice without Ground Check rotating with it, but still follow my character? Code: using UnityEngine; using System.Collections; public class Player: MonoBehaviour { ...
0
votes
0answers
18 views

Character fixed angle? [duplicate]

I want my character to rotate so I turn off fixed angle in Rigidbody 2D, but the problem here is that I can't jump in any other angle except for the angle where I have my groundcheck. Can anyone help? ...
0
votes
0answers
38 views

Character can't jump in other angle with fixed angle off

I turn off fixed angle so my character can rotate, but it can only jump in 1 angle but I want it to jump in every angle. How do I do that? Code: using UnityEngine; using System.Collections; public ...
0
votes
1answer
162 views

How do I make my character jump in every direction?

My character can only jump when he is grounded, but he can only grounded in one direction I want him to jump in every direction, can anyone help? CAN JUMP : CAN'T JUMP : Code: using ...
0
votes
2answers
194 views

A 2D Camera Follow Script That Does Not Rotate?

I am attempting to make a 2D racing game. So far I have a player car (sprite) and a main camera. I would like to know how to make the main camera follow the player car while still showing signs of ...
0
votes
2answers
186 views

How do I make my character jump in any angle?

My character is a square which can spin in any angle but it can not jump in certain angle Can anyone help? using UnityEngine; using System.Collections; public class Player: MonoBehaviour { public ...
0
votes
1answer
113 views

Actually Implementing “C# as a scripting Language” in XNA

Following an example from this thread, I've made an application that dynamically loads in C# "scripts" (actually, plugins) into my game -- but I've hit a snag: how do I reference the assemblies for ...
1
vote
1answer
93 views

How do I make my character stop going left? (Unity)

So I have this code and my character can go left, right and jump. I don't want the character going left , so how can I remove that. (I'm very new with coding) using UnityEngine; using ...
1
vote
1answer
560 views

Animator has not been initialized

My animation is working but unity keep saying that my Animator has not been initialized error Here my Code: using UnityEngine; using System.Collections; public class Player: MonoBehaviour { public ...
2
votes
3answers
139 views

How does Unity call “update()” in the scripts?

I understand that you can expose your C++ code to a scripting language such as ChaiScript. From this you can call code that you've made in C++. In Unity, however, they have functions in the script, ...
0
votes
1answer
460 views

Unity 5: 3rd Person Controller runs by default. How to change this?

I have been working with the Third Person Controller of the Standard Assets (called Sample Assets in the beta versions) in Unity 5. When the player press the forward button, the character runs by ...
2
votes
2answers
211 views

DontDestroyOnLoad() doesn't work in Unity

I have a problem with DontDestroyOnLoad() in Unity. It does not work! My code: private static PlayerSpawningScript instance; public void Awake() { Debug.Log ("PlayerSpawningScript awake"); ...
1
vote
1answer
403 views

Instantiating prefabs dynamically in script

I have a canvas object. I right click it and add a Button, which defaults to having a rect transform, image script, button script and text child object. I make it a prefab and delete it from my ...
0
votes
1answer
65 views

Compiled vs Scripting Plugin System

I'm making a very simple game that revolves mostly around user-created mods. So far I've seen most games using Lua or something like Lua to enable user scripting, but recently I've seen people using ...
0
votes
1answer
98 views

Unity Collision Difficulties (How do I make a ground in unity with lots of pieces that doesn't have poor collision?)

So I'm working on this game that I came up with the idea for while watching the Unity Roll-a-ball tutorials. So it's probably important to note that I'm extremely new to game design and I don't have a ...
0
votes
0answers
130 views

Physics2D.OverlapCircleAll seems to be bigger than my radius

Im trying to make a "Scorched earth"-like game using unity. I managed to fire my bullet and make it explode on contact. What I am trying to do is do some damage to the tanks even if the bullet didn't ...
0
votes
0answers
209 views

Anti-Roll bar doesn't work

I'm making a racing game in Unity that has trucks as vehicles. For the truck movement, I'm using WheelColliders. After some testing, I found out that after a certain speed (~60km/h), turning made the ...
1
vote
1answer
293 views

How to write testable MonoBehaviour and test scripts in Unity?

I had problems with decoupled scripts and exposing interfaces in Unity, and these answers helped me a lot. But now, since I don't have hard-coded references in my scripts, I wanted to write unit tests ...
18
votes
7answers
2k views

How can I avoid tight script coupling in Unity?

Some time ago I started working with Unity and I still struggle with the issue of tightly coupled scripts. How can I structure my code to avoid this problem? For example: I want to have health and ...
0
votes
2answers
172 views

How do I access my existing script from a different script attached to a different gameobject?

I have my health(script) component on my player gameobject that gets boosted whenever we tap on that gameobject. However, I want to add a separate Gui texture button gameobject and tap on that to ...
1
vote
1answer
170 views

Questions about scaling in a 2d game in unity

Okay, so: I am making an android game. I want everything to scale to the size of the screen I'm using. Further, my static background needs to scale (as well as every other object), but if the aspect ...
0
votes
0answers
81 views

Google Developer Console Error message

i received my first crash report of on Google Developer Console yesterday and im completely lost. Did anyone receive this error before and how can i go about fixing it? Any help would be greatly ...
1
vote
2answers
270 views

NPC daily routines and scene loading

I'm making a basic survival RPG in Unity 3d. I'm separating my world into different scenes to save memory but I'm not sure how I'm going to program NPC daily routines. For example, if the player ...
1
vote
0answers
95 views

Scripting language for high complex educational game [closed]

I'm at a stage of working at my C++ game that I need to implement a script language to allow the players to perform tasks inside the game's logic. I'm a sole programmer and thus it's entirely ...
0
votes
0answers
83 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 ...