Tag Info

New answers tagged

0

I have done something similar to this in the past. My solution to this would be to make use of Unity's new UI Mask and a Render Texture. When the player touches the screen you would draw a circular sprite at that location and render it to a texture. You would then use this texture for the mask. Over time these sprites will reveal more and more of the image ...


0

Assuming no setPixel, make a "single dirt bitmap"(1). Place a bunch of texture2d objects(2) (using image(1)) over the "card" and make them disappear when you move over them. You can define properties on each (2) , so that one Texture object may take two (or more) scratch to disappear.


0

Seem to me that you only changed the pivot point of the text, not the position. You can see the location of the text is relative to the pivot point which is X: 430, y: -223. You need to hold shift & alt when align the text to top left to also change the position and pivot point of the text. Alternatively, you can set your x, y, z coordinate of the text ...


0

Before I answer this question here's a quick idea of how I would go about implementing an infinite or endless runner. I have worked on a couple of endless runners and they have both worked in the same way. This isn't necessarily the only way to do it but it is a way that has been proven to work. You can create generic sections of a level that contain ...


1

The Image Effects source code should give you a good idea how to render into a render target. You can import the package and look through the source code to get an idea of how they happen. The basics are: render a quad that covers the full size of the render target the shader does the blending you're talking about by using the previous render target ...


0

Using the CustomEditor attribute should certainly work for the Transform component. I have my own custom editor for transforms to make resetting them a bit easier. By creating the following CustomEditor you will notice that the localRotation changes from displaying three values that represent the Euler angles (x, y, z) of the rotation quaternion to the 4 ...


3

As Jinbom said the main difference here is speed. However it is important to note that this is only the case for the transform property of GameObject. Other properties such as camera and rigidbody are just convenience properties and call GetComponent<> under the hood so the performance is identical. It is for this reason that Unity has deprected these ...


0

Presumably you hit "Build and Run"; that will cause Unity to first generate the APK, and then attempt to automatically install that on the connected device. Personally I recommend "Build" to just generate the APK and save it somewhere; then you can install it yourself after the APK is generated.


2

There are a couple spots that could be relevant. First off, you can set the Min API Level in Player Settings (click the Player Settings button on the bottom of that screenshot). But besides that, you can manually provide your own manifest file; it looks like right now you are simply using the manifest that Unity automatically generates if you don't provide ...


2

I suggest to use a tree class aproach. Place Main text into nodes and choise text into arcs (arrows) Multi page Text can placed into sequential nodes with only one choice arc ("Next page") Rough c# implementation: public class DialogueArc { public String Text { get; set; } public DialogueTreeNode outgoingNode; public DialogueArc(String text, ...


2

Shawn Hargreaves wrote few slides for Xbox live gaming, concerning latencies, you can check the full presentation from here Bandwidth - How much is available? Assume 64 kilobits (8 kilobytes) per second 0.5 Mbit/s ADSL has theoretical limit of 64kbs


4

The Speed (fast to slow): cached _transform >> Component.transform >> Component.GetComponent<Transform> And If you disassemble a UnityEngine.dll C# binary, you can see transform do not call GetComponent (Component class member), just call internal mono runtime method. Here is the transform code. // UnityEngine.Component public Transform ...


1

Right now you can assume that every game object will have the Transform component due to the this.transform syntax. My guess is that Unity updated its API with the GetComponent<>() syntax was so that in the future you could have GameObjects without "special" components like Transform. Then you can have a "purer" architecture where your GameObjects ...


0

Go to here: http://docs.unity3d.com/460/Documentation/Manual/NetworkReferenceGuide.html It's the Networking reference guide for Unity, and should tell you everything you need to know about how to make servers/clients in Unity. I can also answer specific questions if you have them.


2

In "tiles" value, you should change all the curly braces to brackets. In JSON, curly braces mean an object, while brackets mean arrays. Also about parsing JSON, once you actually have the content of JSON file (via reading the file for example!), there are lots of pure CS libraries to help you parse it. Json.Net for example.


3

Your balloons are gameobjects right? I find that in general, adapting your ideas to how Unity works yields better results than hacking around the limitations. I use this component-based approach to do pretty much everything involving composition, and it's especially handy to change the behavior of objects on the fly or in the editor, without ever touching ...


0

You can detect the side of the cube via the following algo public enum MCFace { None, Up, Down, East, West, North, South } public MCFace GetHitFace(RaycastHit hit) { Vector3 incomingVec = hit.normal - Vector3.up; if (incomingVec == new Vector3(0, -1, -1)) ...


3

Some facts: unity supports serialization of polymorphic types only when derived from MonoBehaviour or ScriptableObject reference to Interfaces won't be took in consideration by the serializer, even if the actual instance is of a serializable type Now, I often prefer programming against interfaces, so I faced similar problem several times (unfortunately ...


1

Selecting the Camera Object and Ctrl+Shift+F seems to do the work in Unity5.


1

try GameObject Menu->Align View To Selected. "Select the Camera (GameObject) that you would like to look through while in the Scene view. Then go to the "GameObject" Menu and select "Align View to Selected." "


3

Here are the steps for applying scripts to multiple objects. Step 1. Select all your objects from Hierarchy panel. Step 2. Then from Project panel drag & drop your script into Inspector panel.


2

You can add script at runtime. You can create an empty objects with a script that "browse" the 200 or more objects and atach the sript to each of them AtachScriptAtRunTime Example: to add the script named FoobarScript to the game object use: gameObject.AddComponent ("FoobarScript"); Clearly you must recognize all the objects. (example you can use ...


0

transform.position = Vector3.MoveTowards(transform.position, target.transform.position, speed * Time.deltaTime); You do know that if the target's position is on the ground, then your object's position will also try to match the objects's Y position. You can try to make an object and check all the constraints, and it will still work if you give it a ...


1

Non sequitur, your question does not entirely make sense. You cannot store infinite chunks. You can only ever store the subset that is currently of interest, i.e. those around the player(s). So how does the infinite part work? You generate chunks according to some global function. For example, Minecraft's use of Perlin noise (a global function) means that ...


0

A great explanation of a well known voxel chunk system can be found in the minecraft wiki Regardless of how you want to store the data programmatically, the ability to generate smooth flowing infinite voxel terrain comes down to a smartly optimized neighbouring chunk loading system. "The exact number of generated chunks varies in single player mode, ...


0

Game host: The machine hosting the game Host server: An application which manages connections and transfer of data between clients Client: A copy of your game participating in the multiplayer game If you wanted to do it yourself, you'd need to write a host server which is bundled with your game. When one of the clients selects 'host game' (or similar) ...


0

Using the same metaphor of building and rocket and assuming that as the Rocket is flying through the air doing its stuff then it will already be a dynamic, simulated object with a rigidbody, a possible quick way to do this would be to have a collider with isTrigger = true on the building. When OnTriggerEnter() fires, you can then add a rigidbody and any ...


0

Move the bottom scroll bar to the right to reveal the plus signs


0

So you want to generate a random integer, and use the number generated to choose between a set of events. Seems like the best thing you could use would be switch case? Switch : int caseSwitch = X; //your random generated integer switch (caseSwitch) { case 1: //if it's equal to 1 then Console.WriteLine("Case 1"); break; case ...


1

Provided all the events have the same signature: delegate return_type Event(parameter_list); Event[] events = { new Event(Event1), new Event(Event2), //..... new Event(EventN) }; //in your caller method events[random_int](parameters); Delegates are the fastest and easiest method to accomplish what ...


1

Trail or line renderer: http://docs.unity3d.com/Manual/class-TrailRenderer.html. Just have a darker texture to overlay the snow and continuously set a new position for the trail renderer.


2

If you want to be hardcore about it... public static bool StringComparison (string s1, string s2) { if (s1.Length != s2.Length) return false; for (int i = 0; i < s1.Length; i++) { if (s1[i] != s2[i]) { Debug.Log ("The " + i.ToString() + "th character is different."); return false; { } return ...


1

PlayerPrefs are not designed for saving scores. They are easily modifiable by the end user in a text file. Instead, you should serialize settings, replays, etc. that players have no motivation to hack. Knowing that, this is how you save to PlayerPrefs: int Birthday; void Start () { Birthday = 172589; PlayerPrefs.SetInt ("My Birthday", Birthday); } ...


2

Without a doubt, an executable per map would be the best option because servers run collisions detection. Collision detection increases in complexity by O(N) so a single instance with 500 objects will be much slower than 5 instances with 100 objects each. There is a small overhead for each individual executable instance but compared to physics and other ...


1

If you have trouble getting a good blend in between your animation states you could break it up using Invoke() within your OnTriggerEnter(). I don't normally like to do this but it will most likely solve your state issue and give it time enough to show the idle before your jump. Invoke("PillarAddForceMethod", .6f); void PillarAddForceMethod() { //ToDo ...


0

Your transform's position will be located at your sprite's pivot point. Depending on your sprite, when you rotate, it may offset your position high enough to no longer be Raycasting properly. Consider the above image. Left side would represent 0 rotation. Right represents a rotation of 90 degrees. As you can see, the Raycast would fail with this ...


0

Add a physics raycaster to your camera and an EventSystem to your scene, then implement the IPointerX (up, down etc) handler in your script.


2

That's not using GetComponent() on the class GameObject, it's using GetComponent() on the result of GameObject.Find() GameObject.Find() is a static function, but it returns a specific object. Note that Code 2 is also using GameObject.Find() but then you store the result object in a variable. Code 1 uses the exact same functions but doesn't store the result ...


0

Just set isEnabled of the desired UIButton to false. This will just disable it's collider, and it will still be visible. :-)


1

Select the Light object Go to Inspector Light And change rendered mode "Auto" to "important"


1

Yes, unity does make the calculations itself. Test case: Game Window -> select different resolutions and run the following code: private void Update() { if (Input.GetMouseButtonDown(0)) { firstTouchPos = Input.mousePosition; } else if (Input.GetMouseButtonUp(0)) { endTouchPos = ...


0

Your understanding of Vector3.MoveTowards() is close, but not quite right. public static Vector3 MoveTowards(Vector3 current, Vector3 target, float maxDistanceDelta); Each time you call this method it returns a point along the vector from current to target that is at most maxDistanceDelta away from current. So if current is (0.0, 0.0, 0.0) and target is ...


0

In the description for that video (click "show more") you'll find he also posted a tutorial on how he did it. The tutorial starts here. He also has it posted on the asset store here.


0

I came up with a simplistic solution to this a few years ago in a non-realtime context (mesh slicing for 3d printing). Given a plane defined in world coordinates by a point (origin) and a vector (normal). First setup a matrix that transforms your mesh into the coordinate system of the plane. Now do a z-bounds check of all the edges of the mesh (i.e. ...


0

You must call iTween once. You would then call it each update. For example: public class doubleTween : MonoBehaviour { // Use this for initialization void Start () { iTween.RotateBy(gameObject,iTween.Hash("x", .25,"time",2, "easeType" , "easeInOutQuad", "loopType", "pingPong", "delay", .2)); ...


0

One of the way to achieve this would be to replace the graphics model of your game object with a more destroyed one. Another way to achieve this would be to have an animation with the different states of your "crashed car" and step through each key-frame on a per-need basis (for instance, 4 key-frames, from pristine to completely crashed; no hit -> keyframe ...


0

I seen your video and it seems to me that your problem might be in Exit condition of the second animation. You need to have your logic set up like this : http://gfycat.com/ElasticPastBlackcrappie In your code you need to set the same toggle state for both your animations. And you need to set the condition for both of them, to work if the toggle is on. Now ...


0

A more reliable and efficient method of syncing new players is delegating this task to another player. Since Photon's servers aren't authoritative, this is the next best option to catch someone up. One method is to send an RPC to the master client telling it to catch you up on the game state. The master client then sends you a stream of data giving you ...


1

Your code doesn't seem to have any "rotation" for me. Plus you're addressing r.eulerAngles, which is why your rotation is failing. Quote from Transform.eulerAngles : Only use this variable to read and set the angles to absolute values. Don't increment them, as it will fail when the angle exceeds 360 degrees. And for the next part, what are you ...


0

Apparently Unity only render one face of the quad with the default shader (you can test it by moving your camera around). By setting another shader (in your case "Sprite/Default" should do the stuff), it will render both faces. At least it solved the problem for me. The reason it work with negative z is that a negative scale will flip the quad (thus ...



Top 50 recent answers are included