Answer by khenkel
The type you're probably looking for here is AudioClip. **Play()** plays the stored AudioClip in your AudioSource. (assigned in the Inspector or via "audio.clip = myClip;") **PlayOneShot(AudioClip...
View ArticleAnswer by khenkel
I would recommend to separately compare the r, g, b and a variables (respectively only the ones you need). Also try printing the values of colour2 separately (eg. "print(colour2.r + ", " + colour2.g +...
View ArticleAnswer by khenkel
Use this: function Update() { if(Input.GetKeyDown(KeyCode.Alpha1)) { audio.mute = !audio.mute; } } It didn't recognize your "1" string. Also the muting is more clean now.
View ArticleAnswer by khenkel
UPDATE: Use this: private const float MOVEMENT_TIME = 2.0f; // The object moves for 2 seconds private const float MOVEMENT_DISTANCE = 10.0f; // Distance the object should move void Update() {...
View ArticleAnswer by khenkel
I am assuming your game is for children. In this case your game needs a so called "parental gate". It ensures that the child is able to use the app safely, for example by having a text say "Ask your...
View ArticleAnswer by khenkel
I can't spot any errors in your code right now so I suppose that your obstacleGenerator Start() doesn't get called at all. Maybe there's no instance of your object, or you're accessing the wrong object...
View ArticleAnswer by khenkel
Yes, either put it in the FixedUpdate(), OR only multiply with Time.deltaTime **where you are actually changing your object's position/rotation/scale**. In your case, remove it from the upper parts and...
View ArticleAnswer by khenkel
Try renaming the GameObject to something else, because "light" is already used. Every GameObject has a light variable by default (doesn't matter if it exists or not) and you're trying to access it....
View ArticleAnswer by khenkel
I would recommend to use particles for this. This actually requires a lot of particles, but Unity can handle them quite good. You can use the default (circular) sprite for this. Just give them a color...
View ArticleAnswer by khenkel
This is quite hard to achieve from scratch imo and unfortunately I can't provide a perfect solution. But I can give you some ideas about this: - This programmatic blending requires a custom shader. I...
View ArticleAnswer by khenkel
As a quick solution I would suggest setting a bool to true in the OnServerInitialized() and polling it in the OnGUI(). Something like this: bool serverInitialized = false; void OnServerInitialized() {...
View ArticleAnswer by khenkel
I haven't used this yet, but try out the OnBecameInvisible() method. Something like this: void OnBecameInvisible() { // Position change } See here for more info:...
View ArticleAnswer by khenkel
You need to modify the entire velocity variable. x, y and z are read-only. Nonetheless it is not recommended to modify the velocity variable. You should use Physics stuff instead, like AddForce()....
View ArticleAnswer by khenkel
There can be a few reasons why your Raycast "doesn't seem to work". I don't know what exactly doesn't work, so I'll provide some ideas: - First of all, Physics.Raycast returns a bool, so you might want...
View ArticleAnswer by khenkel
That's because you're using Time.deltaTime as the fraction parameter in Lerp(). This is NOT an actual time value but the time in seconds it took to complete the last frame. I didn't read up intensively...
View ArticleAnswer by khenkel
I think you might want to start with the Unity documentation: [GUI Basics Tutorial][1] [GUI.Button reference][2] I'm sorry for only providing links, but I think writing code for you or extensively...
View ArticleAnswer by khenkel
First of all you can write: if (DentroEscalerilla) { // Stuff } You don't need to double compare it with "== true". About your problem: How big is the cube? Does it fill the entire ladder "area"? If...
View ArticleAnswer by khenkel
Well, in general your player can collide with pretty much anything (not only bullets), so the best way is to only perform code on specific bullets. You have the Collision parameter for this. Something...
View ArticleAnswer by khenkel
Simple answer: Physics.Raycast() ITSELF is NOT related to the screen resolution. Better answer: Your problem is probably related to your "overray" Ray object (eg. when you're creating it via...
View ArticleAnswer by khenkel
I assume you mean the "Static" flag at the top of the Unity Inspector. Enabling "Static" only affects things such as Lighting or built-in Navigation systems. See [this link][1] for more info. It does...
View ArticleAnswer by khenkel
Unity always creates its own internal copy of the particular file, which might be much smaller than the original file (eg. with PSD files). But this highly depends on the file type you are using. You...
View ArticleAnswer by khenkel
This doesn't depend on the scene your material is used in. Just create a public Material _material; in your script, assign the particular material in the Inspector, and change its properties via code....
View Article