Tag Info

Hot answers tagged

12

What you want is a memory profiler, Which Unity does have. Here: http://docs.unity3d.com/Manual/ProfilerMemory.html But your assumption is mostly right, if a gameObject is not visible to the camera it is not drawn, and it uses less resources, but it still must consume some. The gameObject still exists in memory, including all the textures, models scripts ...


9

Well, I'm honestly not an expert on this but... I think it depends on how complex and varied you think the attacks will become. Since it's an RTS I'm guessing you'll have maybe 10-50 or so different units or structures with their own attack types. Option 1: If there is a relatively low number of units that will have attacks that are somewhat similar I ...


7

According to the Unity store page, the $75/month subscription is locked in for 12 months, so it would cost $900 for one year. (click the $75/month price link for subscription details) If you wanted to update your game after one year, you would need another subscription after that, so maybe $1,800 all up if you plan on updating your game after a year. Or, ...


5

Finally I found a way to do it (tested in v5.0.0), in a way that: Does not need code, or conditionals to check orientation. Does not hack with scales and neither needs a reference resolution. In the UI video tutorials, there is a big part missing, although well documented in the text-documentation: The "auto-layouts" system. Auto-layouts are mechanisms ...


4

We just have to declare Awake, Update, and any other function created by us, to be public and virtual on the parent. Override the function on the children. public class AgentBehaviour : MonoBehaviour { public virtual void Awake() { // your code here } public virtual Vector3 GetVector3 () { return new Vector3(); } } ...


4

I don't know a whole lot about Unity and I haven't done game development in a while, so let me give you general programming answer to this question. I have based my answer on the knowledge I have about entity-component systems in general , where an entity is a number that is associated with N many components, a component only contains data, and a system ...


4

I think you should also know about Frustrum Culling, or hiden surface removal: http://en.wikipedia.org/wiki/Hidden_surface_determination This is an important bit of optimising a game, because even if your objects are not inside the frustrum at a given frame (i.e. visible), some draw calls (shaders) are still launched for them, therefore decreasing ...


3

You can use the OnBecameInvisible callback for that. Just implement something like: void OnBecameInvisible(){ // disable or destroy gameobject } The method will get called when the object isn't being rendered by any camera anymore. This also includes cameras from the Unity-Editor. So if you're running your game and have the Game and the Scene view ...


3

You seem to have rectangles that are sandwiched: You have rectangles A, B and C A directly above and is overlapping B, which is above and overlapping C. The update for A is done, pushes it a bit up. The update for B is done, pushes it a bit up because of C, and a bit down because of A. B hasStopped because it did not move because your [x|y]Shift is ...


2

This is possible, but with probably just a small line of code or two for defining whether or not the screen is landscape or portrait and changing a couple values. On the Canvas, you need to make the Canvas Scaler's "Ui Scale Mode" be "Scale with Screen Size", and make "Screen Match Mode" be "Match Width or Height": Assuming the default Reference ...


2

Unity 5 just came out, and they changed the API for a call like object.rigidbody Specifically, every component shortcut other than object.transform has been removed, since the Transform component is the only one that all objects have. All the other shortcuts only applied a fraction of the time. Now you need to access the Rigidbody component using ...


2

As this rapid google search states: gameObject.tag="new_tag"; Obviously your "new_tag" has to exist inside the editor.


2

When a unit/structure/weapon attacks, I would probably create an Attack (subclassed with all your fun details) that takes the attacker and the defender (or defenders). The Attack can then interact with the target/defender (slow, poison, damage, change state), draw itself (beam, ray, bullet), and dispose of itself when it's done. I can foresee some issues ...


2

Draw each circle on some memory, then after all are drawn, set the inside of every circle to zeros, clearing any intersection lines. clarification On some memory is meant to indicate separate texture Set to 0 is meant to indicate set to transparent. setting inside transparent on second draw sequence is fill with transparent color with fillcircle of radius ...


2

you might try having the on enter adding the enemy to a 'target list', and on exit/killing enemy have that entry removed from the list. using System.Collections.Generic; // lets use use the magical 'List' array List<GameObject> targetedEnemies; // List arrays let us add and remove stuff later, // that is, they do not have a maximum capacity and won't ...


2

The short answer is "yes"; anything that is ready to be used in your game is taking up memory. The other thing to consider is the cost to your frame-rate: 5 objects, with 5 separate textures, drawn separately require state-changes in-between. You may be able to save some memory by unloading textures that aren't used. By loading all of the separate ...


2

As pctroll said, the right solution for you is to use virtual functions. To answer the question "how does Unity do that" without virtuals (i.e.: you don't have to override Awake or Update in MonoBehavior derived classes) they use Reflection to call theese functions by their names (string).


2

Parent the objects to bones and they will move with the bones.


2

this problem is divided into two situations´╝Ü first: sword, this thing can be just parented to the bone, then it will move with bone; second: cloth, in blender, you need to use the same armature, then create two different cloth, and rig the cloth mesh to the armature. in unity3d, read this article: ...


1

what about: Animator[] anims = new Animator[number_of_animators]; anims[0] = anim0; ... if you mean to have an array editable inside the editor you can declare it as public and you will specify inside the editor its size and you will be able to drag and drop elements into it just like this: public Animator[] anims; this is to be declared just as ...


1

That seems like a very basic task, if I understood correctly. Obviously, if one node can fit only one blinky, then your function has to satisfy the following condition: Amount of blinkies <= amount of nodes. And there're several ways to loop until you have placed a blinky. One would be just decrementing the iterating variable: if(randomNode.walkable) { ...


1

Perhaps this is what you are looking for: transform.forward = transform.up;


1

Looks like the options are ... Implement your own version of the rigidbody script. Make your world a whole lot bigger and rotate it under the player as they move rather than rotating the player round the world.


1

Hello I suggest you use Raycasting to test if the camera is directly pointing to the light source. The ray will go from the camera into the front vector direction, Once you get the RaycastHit, you can check the name, the tag or even use Layer Mask to selectively ignore colliders. If you want to apply the effect even when the camera is not pointing directly ...


1

If you don't care about the interior being painted in, there's a really simple solution. First, draw all circles in black. Next, draw all the circles again in white, with a smaller radius - basically subtract a border width from the radius. The result will be a constant thickness black border around a white area. You could maybe even use this black / white ...


1

You probably could draw, and save 'intersection points' any point where two circles draw a point at same location. Then use that set, knowing that inside and outside changes when an intersection occurs. You would then only need to check any one point between two intersections to know the status of an entire arc between any two intersections. Fewer checks ...


1

The GameObject car is not set to anything. That means it's null. This is exactly what the error message is telling you. Just because you happen to have a prefab named 'car' in your Assets folder doesn't mean you can name a variable car and expect Unity to know you're talking about the same thing. See my answer to your other question to learn one way to ...


1

If you put the prefab into a directory called Resources inside your Assets directory, you'll be able to use the Resources class and its load functionality. This will load a prefab up as a GameObject, which can then be instantiated. For example: GameObject myRoadInstance = Instantiate(Resources.Load("road")) as GameObject; Will create a instance of your ...


1

maybe you don't get the reference to the right animator, to TEST (or DEBUG) define it public public Animator anim; , run the game and watch in the inspector if it has referenced the right one. If the animator you need is attached to the same object where you attached the script it should work, but if they are not attached to the same game object it doesn't. ...


1

It is not the "engines". You can do it with anything, even if you program your game hard-code. First you need to learn "Procedurally-generated game content" and it isn't a new thing. Games before Elder Scrolls Arena games did that. You can surely do that on demand (as the player explorer the level) but it will take a huge badass machine to not bottleneck ...



Only top voted, non community-wiki answers of a minimum length are eligible