Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [unity3d]

Unity, also referred to as Unity3D, is a cross-platform game engine with a built-in IDE developed by Unity Technologies. It is a commercial development platform for creating games, interactive 3D applications, training simulations, and medical and architectural visualizations.

Filter by
Sorted by
Tagged with
2
votes
1answer
2k views

Getting Facebook app requests

I have a JSON response from the Facebook API, which contains the app requests of certain Facebook apps via FB.API('/me/apprequests') (using Graph API 2.0, Facebook ...
8
votes
2answers
473 views

Is my implementation of FizzBuzz overkill?

I am doing FizzBuzz on a take home test (in Unity). I am sure this is just a competency check, but I went ahead and followed some coding conventions such as using constant fields, dependency ...
5
votes
2answers
74 views

Method that renders all existing drawn lines on the view

I have several tabbed views with a Unity scene in them. What I do between scene is hide the elements in that scene, then render them if the right view is shown. The method below is the method that ...
5
votes
2answers
1k views

Calling a method to draw parallel lines

This question is a followup to the last one. I followed RobH's advice and his edge case bug found in my code with this solution: ...
4
votes
1answer
2k views

Number Wizard game

This is a number guesser that guesses a random number between the values that you set. The user has to use the up or down arrow keys to say if the number that they thought of between the number ...
0
votes
1answer
700 views

Helper class to interact with Unity's PlayerPrefs system

Unity3D has a class for platform-independent data storage called PlayerPrefs. Supported data types: int, ...
2
votes
1answer
61 views

Removing checks that are only necessary on first pass

I've got a function that's executed in a game loop. There are a couple of checks that are really only necessary during the first pass of the game loop. How can I remove these? There is more code like ...
5
votes
1answer
322 views

Multiple functions to establish a fallback value for a property until not null

I have a property (called "Head") that can be set externally. When "Head" is not set, it uses Unity3D's MonoBehaviour functions to try to find the best value for "...
3
votes
1answer
160 views

Speeding up the process of obtaining data

I created this script to obtain data from graphs online, from monavisaxmldata. I were wondering if there was a way to obtain the data faster. The program which uses this data gets presented in a ...
4
votes
2answers
279 views

Importing different type of files into Lists

I am using a recursive directory scan to find all objects inside a Unity3D project. After that, I wish to move all these files to a sorted List. Is there a cleaner ...
4
votes
1answer
408 views

Water generating waves and reflection

For the last few days I have been working on wave generation script. As there are a lot of calculations involved I was looking for possible optimizations to improve the performance of the code. This ...
3
votes
1answer
89 views

Slow update function

I've been fiddling with Unity, trying to make nice walking/running animations. So, i found the Stealth tutorial and I used pretty much the same animator as the AI, only I only use Speed and ...
4
votes
2answers
697 views

Checking for duplicate materials

This is a follow up question of Importing different type of files into Lists. Where the original lists are acquired. In this script I am processing the obtained lists, and comparing them with each ...
6
votes
2answers
6k views

Enemy patrol script using NavMeshAgent

I'm piecing together an Enemy script to attach to my characters. This is the portion that related the a game objects ability to patrol to given locations. Basically,...
4
votes
2answers
460 views

Triggered movement script for triggered objects

I am trying to more or less perfect a movement script that activates when "triggered" by another object. Below I have the code for both the triggering object as well as the object being triggered. I ...
3
votes
1answer
344 views

Game stats storage / display

I have a simple game where you try to go as high up with rockets as possible. I currently store 2 statistics about your playthrough: Current altitude Highest altitude These statistics are stored in ...
4
votes
2answers
791 views

Dynamic Storing Objects from XML in RPG

I would prefer if more experienced users could give pointers on how I can optimize and think better when writing code. If you are unfamiliar with unity3d, ignore the use of UnityEngine, the heritage ...
5
votes
1answer
390 views

Random interval generator for a game

I have been working on a few games which all have a need to create "events" randomly over time. The intervals need to get shorter as time goes on if the event is negative or they need to get longer ...
10
votes
1answer
4k views

Inspector interface serializer

I've written some code that allows Unity3D's inspector to display fields that conform to an interface. Unity has some quirks about their inspector, so as a preface they are listed here: If you add a <...
6
votes
2answers
465 views

Rotating a character upside down and vice versa

I have a pretty straightforward task, but I find it hard to figure out how to improve it. The code is pretty straightforward, but rather bad. There are some clarifications / extra details at the ...
1
vote
1answer
131 views

Is there a beter way to check input besides a switch case?

So I am running a Switch case to check if a user has filled in all the necessary fields within a form, and if not I prompt them to do so. I was wondering if there was a better way to do this, or if a ...
5
votes
2answers
3k views

Fastest way to find and replace inside a large amount of files

Currently I am looping through dependencies of objects, and I am trying to replace GUID (unity object ID's) inside the files. Right now I am using the following code, any suggestions for improvement ?...
5
votes
3answers
141 views

Determining vehicle jump landing quality

I am writing a game where a car drives and makes jumps. When a jump is landed, the player is rewarded if they land all four wheels either at the same time, or near to the same time. If they don't, ...
4
votes
1answer
326 views

Creating a masonry effect with varying height rectangles

The following is used to create a masonry effect with varying height rectangles. How can I simplify and make this more elegant in Unity? ...
3
votes
1answer
206 views

Pooling System: is it worth improving or not for a simple implementation?

I am using Unity3D and I made a super simply pooling system to reuse a specific object. My only concern is I am not sure if I am doing it the best possible way. If I were doing this in C++ there would ...