Quantcast
Channel: Answers by "FakeBerenger"
Browsing latest articles
Browse All 58 View Live

Answer by FakeBerenger

Use fraction of the Screen's size for you're rect. Like : Rect(Screen.width * .1f, Screen.height * .1f, 100f, 100f)

View Article



Answer by FakeBerenger

You need to use the function [Random.Range][1], and the number of children [transform.childCount][2]. Note that the range function with int is [a,b[, so you don't need to substract one to the child...

View Article

Answer by FakeBerenger

Use GUILayout.BeginScrollView() : http://docs.unity3d.com/Documentation/ScriptReference/GUILayout.BeginScrollView.html

View Article

Answer by FakeBerenger

Try Vector3.SmoothDamp, and change the target point when you're under a safe distance of it, like one or two.

View Article

Answer by FakeBerenger

It's unecessary to destroy and instantiate an object whe all you want to do is show/hide. You can either play with the **gameObject.active** boolean (mind that the OnTriggerXXX functions won't be...

View Article


Answer by FakeBerenger

Basically you need to save all the relevant parameters onto your hard drive / server, like those you use to create them and then position / rotation / ... Now, let's see how. You should take a look...

View Article

Answer by FakeBerenger

Easier than iTween (Not that is particularly hard ...), there is still Mathf.Lerp / Vector3.Lerp. Oh, and checkout that link if you want to continue with iTween :...

View Article

Answer by FakeBerenger

[Try this out.][1] [1]: http://wiki.unity3d.com/index.php/AdvancedButton

View Article


Answer by FakeBerenger

The GUI is drawn after all the 3D, so no you can't. But you can cheat, and display your GUI on a 3D plane in front of your camera, but you'll have some development to do here.

View Article


Answer by FakeBerenger

How to trigger an action and how to play an animation are two different things. Let's start with the last one, easy : [animation.Play("DoorOpening")][1] or whatever the name is. (Make sure you have an...

View Article

Answer by FakeBerenger

- Create an enum and check it when you move. If it's Y_only, for instance, then do newPos.x = oldPos.x; - When you click on a collider, you can get the impact point ray / collider. You just have to set...

View Article

Answer by FakeBerenger

In OnBecameVisible, use a raycast to make sure the chair isn't behind a wall.

View Article

Answer by FakeBerenger

I think you're a bit a confused between the type string, which is a value you can affect to a variable, and the name of that variable which is the point to your compiler what is going on. Anyway, you...

View Article


Answer by FakeBerenger

That's not your code dealing with damages. That's the code for leveling up. We need the function called when the weapon strikes / the spell hits. Anyway, it's probably going to be along those lines :...

View Article

Answer by FakeBerenger

If you're pro, you can use [movie textures][1]. For the pyramide, you could use line renderers. [1]: http://docs.unity3d.com/Documentation/ScriptReference/MovieTexture.html

View Article


Answer by FakeBerenger

It depends on what component you use for your character. I'm assuming a character controller. You need to create a script and implement a function called [OnControllerColliderHit][1], then attach it to...

View Article

Answer by FakeBerenger

I don't know where you want to freeze the cam (simplify your code by removing every unrelated stuff please), but you'll need on of those : - A timer. When the event happens, store the time and check if...

View Article


Answer by FakeBerenger

The function AddToEquipment is just changing the tag multiple times. Your inventory script is only going to throw an error because you call GUI stuff outside of OnGUI. It's only display anyway, buttons...

View Article

Answer by FakeBerenger

A script I did a while ago. It should do the trick for you : http://wiki.unity3d.com/index.php/TimeOfDay

View Article

Answer by FakeBerenger

I tested it, and your problem is that Gloves is in the same file as Equipment. Create a Gloves.cs. It would have worked with AddComponent( typeof(Gloves) ) though.

View Article

Answer by FakeBerenger

You need an index to access an object of that list (PlayerTimerList[2], for instance). Of course, you must fil it with instances of TimerClass first. About ToString, I'm not sure how it works in...

View Article


Answer by FakeBerenger

If there is a single path and only one solution to go from one point to another, you can use regular animation. If you can travel from several points at a time, you need 4 animations for each : with...

View Article


Answer by FakeBerenger

Well, use a boolean, something like canMove, set to false at start and to true when you hit 100%.

View Article

Answer by FakeBerenger

You can add new entries in the create rollup with [AddComponentMenu][1]. Inside, create the primitive (GameObject.CreatePrimitive(...)) and affect your material. Then clic on whatever name you've set...

View Article

Answer by FakeBerenger

Sure thing. YOu need the reference of the gameObject you want to a the script on though. In your case, the instance you just created. You can use the class name as a string, or the type with typeof()....

View Article


Answer by FakeBerenger

You can disable the script displaying the loading progress, or use a boolean inside the OnGUI function. I can't be more accurate without code.

View Article

Answer by FakeBerenger

I think the problem is the calculation of your vectors VecUp and Fwd. You're using the player's transform, you should use [closest point on cylinder's axis from the player] -> the player's pos, for...

View Article

Answer by FakeBerenger

You could do a string comparison like if( updateString == "Loading: 100%" ) ... But it seems clumsy. You should test on the actual variable progress like so if( progress == 100 ) ... As for disabling a...

View Article
Browsing latest articles
Browse All 58 View Live




Latest Images