Quantcast
Channel: Answers by "TheCatProblem"
Browsing all 28 articles
Browse latest View live

Answer by TheCatProblem

Try something like this: public class TextureSwitcher : MonoBehaviour { public Texture[] texList; int curTex = 0; void Start () { StartCoroutine(Switch()); } IEnumerator Switch(){ yield return new...

View Article


Answer by TheCatProblem

By "return control to Unity" the documentation is referring to the fact that coroutines are non-blocking (when one is called within a piece of code using `StartCoroutine()`, the calling code doesn't...

View Article


Answer by TheCatProblem

The centre of a group of points at arbitrary locations in 2D or 3D space is usually referred to as the [centroid][1]. This is computed by averaging the location of the points in each coordinate (x, y,...

View Article

Answer by TheCatProblem

Assuming the camera controls are implemented using a script, give the script that controls the GUI a reference to the camera script and set the latter's `enabled` variable (see [this page][1]) to...

View Article

Answer by TheCatProblem

It's possible to turn off automatic scaling of textures with dimensions that aren't powers of two. I don't know how Unity handles this under the hood, but I assume it would preserve the actual size of...

View Article


Answer by TheCatProblem

One quick note: if your experiment requires precise timing (e.g., accuracy on the order of milliseconds when presenting stimuli or recording reaction time), implementing it in Unity is not a good idea....

View Article

Answer by TheCatProblem

In a nutshell, call [DontDestroyOnLoad()][1] on the object containing the AudioSource playing the music. For additional details (including a simple way to avoid multiple copies of the same persistent...

View Article

Answer by TheCatProblem

The upper bound of `Random.Range()` is exclusive (i.e., it will never be selected). Thus `Random.Range(0, 1)` will always return 0. See [the documentation][1] for more details. You could instead use...

View Article

Browsing all 28 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>