• Unity3D - Discussion
    5,004 replies, posted
Any idea why this happens to my GUITexts? [QUOTE] [IMG]http://i.imgur.com/rfPaZDx.png[/IMG][/QUOTE] (The text in the top left corner is just squares) EDIT: I found out that the material on the GUIText object had been set to something wierd. Fixed.
[QUOTE=ryankingstone;47126072]Any idea why this happens to my GUITexts? (The text in the top left corner is just squares)[/QUOTE] You forgot to assign the font on the text or the font is missing the characters.
[QUOTE=BoowmanTech;47126276]You forgot to assign the font on the text or the font is missing the characters.[/QUOTE] -snibbidisnip-
I want to do something as simple as rendering a sprite completely white and then lerp it to normal. How do I do this? Do I need to write my own shader? Can I use a pre-built one? Can I do something completely different? I can't use material.color it seems, white just means normal colour there.
I'm making a third person game, and I'm using click-to-move. For some stupid ass reason the character goes crazy most of the time, and I have no idea why. If I increase the distance in Vector3.Distance the character won't go crazy as often, but the position where the character is moving is way off. [code] // Current selected player public GameObject curPlayer; CharacterController controller; public float speed = 5.0f; public Vector3 position; void Start () { controller = curPlayer.GetComponent<CharacterController>(); position = curPlayer.transform.position; } void Update() { if (GameManager.gameRunning) { if (Input.GetMouseButtonUp(1)) { controller = curPlayer.GetComponent<CharacterController>(); locatePosition(); } moveToPosition(); } } void locatePosition() { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition); if (Physics.Raycast(ray, out hit)) { position = hit.point; } } void moveToPosition() { if (Vector3.Distance(curPlayer.transform.position, position) > 1) { Quaternion newRotation = Quaternion.LookRotation(position-curPlayer.transform.position, Vector3.forward); newRotation.x = 0f; newRotation.z = 0f; curPlayer.transform.rotation = Quaternion.Slerp (curPlayer.transform.rotation, newRotation, Time.deltaTime * 10); controller.SimpleMove(curPlayer.transform.forward * speed); } } [/code] UPDATE: My Character controller's radius is 0.5 and the height is 1 if it even matters. This is the only thing stopping me from proceeding with my game.
[media]http://www.youtube.com/watch?v=F2kiu8gaavs[/media] been trying to get the hang of unity for the last 5 days
I am making a 2D game and I added arm rotation in it and it's working properly well but there is one problem and that is when I am rotating the player example below. [code] //Player spawns with rotation Vector3(0,0,0); //And when it turns it changes to Vector3(0,180,0); [/code] The problem is that the arm is a child of the player so when the player turn to 180 the arm also rotates, is there a way to freeze only the Y rotation of the child object? Also the arm Z axis rotates based on the mouse position that's why I can't freeze the whole rotation completely.
You could set the arm to [B]not [/B]be a child of the player, but just find the player object by tag or whatever, and have the arm's position be set to the player's position.
[t]https://41.media.tumblr.com/28365c0d5ebb7f549e07f5e6c43561e3/tumblr_njoi3cfPUv1tsne69o1_540.png[/t] Progress! There's a hud now and laps are now a thing. Also, look at that paintjob!
[QUOTE=war_man333;47128848]You could set the arm to [B]not [/B]be a child of the player, but just find the player object by tag or whatever, and have the arm's position be set to the player's position.[/QUOTE] I did think about doing that but to be honest having the arm not attached to the player doesn't make much sense since it's part of him. [editline]13th February 2015[/editline] Nevermind I fixed the problem. I was trying to modify the Y axis but I actually had to modify the X axis.
I'm doing a puzzle-based 2D sidescroller, I'm looking to start off with an optimal base and the last thing I want to do is have to go back and build it from the ground up when I hit performance issues later on. [B]How should I be generating the world and calculating collisions?[/B] I want to build the basic collision mesh of the world from squares/rectangles, for consistency when it comes to designing puzzles. But I'm not sure how I should do collisions. A couple of places have suggested a tilemap with any exposed edges waiting for collisions. The alternative I can see is for me to just build the collision mesh out of individual planes that are snapped-to-vertex, and throw out raytraces from my character to detect when the character is touching anything with a collisionmesh tag. My biggest concern is speed at runtime.
I would use a tilemap where every tile has a collisionbox2D, but I don't know how much that affects performance
[QUOTE=Maloof?;47131243]I'm doing a puzzle-based 2D sidescroller, I'm looking to start off with an optimal base and the last thing I want to do is have to go back and build it from the ground up when I hit performance issues later on. [B]How should I be generating the world and calculating collisions?[/B] I want to build the basic collision mesh of the world from squares/rectangles, for consistency when it comes to designing puzzles. But I'm not sure how I should do collisions. A couple of places have suggested a tilemap with any exposed edges waiting for collisions. The alternative I can see is for me to just build the collision mesh out of individual planes that are snapped-to-vertex, and throw out raytraces from my character to detect when the character is touching anything with a collisionmesh tag. My biggest concern is speed at runtime.[/QUOTE] If you want something very efficient: [url]http://psychoky.me/2015/01/09/tilemap-to-collision-geometry/[/url] Made by our very own Adnnzzzzz(?)
It's not a whole lot but it took me all goddamn day long so I'm gonna post it. Trying to modify [URL="https://www.assetstore.unity3d.com/en/#!/content/15152"]this[/URL] to work in Unity 5. Results so far: [IMG]http://i.imgur.com/7We1oRw.png[/IMG] The blur effect is currently wonky as fuck, also it doesn't take surface roughness or specular color into account yet (neither of which was present in the original package - dammit!) The code is also incredibly fugly at the moment.
snip
[QUOTE=war_man333;47131461]I would use a tilemap where every tile has a collisionbox2D, but I don't know how much that affects performance[/QUOTE] That would require a GameObject for every tile to attach a BoxCollider2D. I've been down that road; it works but its not optimal. In my current project I use a single mesh to draw all my tiles (divided up with vertices) and map the tile UVs from a single tile atlas texture. Then using the basic tile information (is the tile empty or solid?) I procedurally create several paths on a single PolygonCollider2D. The mesh build, UV mapping and collision build are all done in a coroutine at the start of the level (doesn't need to be a coroutine, but it allows me to have a loading progress screen). After building several prototype 2D tile-based games, this method has shown the greatest results.
I was just using GetComponentInChildren to access an Image component and I remembered how stupid it was built. Why does it even look at the parent if it says 'InChildren', to get the component from the parent I assume you would use GetComponent, this whole situation is so annoying.
Cheers everyone for the replies [QUOTE=foszor;47134952]That would require a GameObject for every tile to attach a BoxCollider2D. I've been down that road; it works but its not optimal. In my current project I use a single mesh to draw all my tiles (divided up with vertices) and map the tile UVs from a single tile atlas texture. Then using the basic tile information (is the tile empty or solid?) I procedurally create several paths on a single PolygonCollider2D. The mesh build, UV mapping and collision build are all done in a coroutine at the start of the level (doesn't need to be a coroutine, but it allows me to have a loading progress screen). After building several prototype 2D tile-based games, this method has shown the greatest results.[/QUOTE] Thanks! Are there any guides on how to achieve this or any places you can recommend to start researching? I'm also wondering - once you've got your collision mesh, do you still use raycast2D to detect and filter collisions with that mesh?
[QUOTE=Maloof?;47135743]Cheers everyone for the replies Thanks! Are there any guides on how to achieve this or any places you can recommend to start researching? I'm also wondering - once you've got your collision mesh, do you still use raycast2D to detect and filter collisions with that mesh?[/QUOTE] For my project, I wanted very specific movement mechanics so I tossed out physics and put together my own collisions detection. I learned the tile map basics from [url=http://youtu.be/bpB4BApnKhM]this[/url] series of tutorials.
[QUOTE=foszor;47135985]For my project, I wanted very specific movement mechanics so I tossed out physics and put together my own collisions detection. I learned the tile map basics from [url=http://youtu.be/bpB4BApnKhM]this[/url] series of tutorials.[/QUOTE] Cheers! I was actually looking at that series before but I figured I'd double check I was on the right track.
Working on a small hobby out of my own interest. I'm trying to create new GameObjects as part of procedural generation of a playable open-world universe, which is half-working. Since Unity likes to scream same the three error per elapsed (galaxy) loop at my face. [t]http://s16.postimg.org/6q79isdj9/screenshot_172.png[/t] [code]GalaxyObject galaxy = new GalaxyObject(); GalaxySector sector = new GalaxySector(); CelestialObject cbody = new CelestialObject();[/code] These are the three lines the engine spits out about. I've tried changing the right hand of the statement to AddComponent() without any success/verification/feedback from Visual Studio. I have no prefabs ready yet for the moment.
[QUOTE=Dromlexer;47136017]Working on a small hobby out of my own interest. I'm trying to create new GameObjects as part of procedural generation of a playable open-world universe, which is half-working. Since Unity likes to scream same the three error per elapsed (galaxy) loop at my face. [t]http://s16.postimg.org/6q79isdj9/screenshot_172.png[/t] [code]GalaxyObject galaxy = new GalaxyObject(); GalaxySector sector = new GalaxySector(); CelestialObject cbody = new CelestialObject();[/code] These are the three lines the engine spits out about. I've tried changing the right hand of the statement to AddComponent() without any success/verification/feedback from Visual Studio. I have no prefabs ready yet for the moment.[/QUOTE] You'll need to create a GameObject first: [code] GameObject obj = new GameObject(); GalaxyObject galaxy = obj.AddComponent<GalaxyObject>(); // etc... [/code] Its probably wise to just make the prefabs.
[QUOTE=foszor;47136043]You'll need to create a GameObject first: [code] GameObject obj = new GameObject(); GalaxyObject galaxy = obj.AddComponent<GalaxyObject>(); // etc... [/code] Its probably wise to just make the prefabs.[/QUOTE] It worked. Cheers!
snip
[QUOTE=Maloof?;47136016]Cheers! I was actually looking at that series before but I figured I'd double check I was on the right track.[/QUOTE] Here's a quick view of how my implementation turned out: [vid]http://www.foszor.com/dump/02132015_1627.webm[/vid] [editline]13th February 2015[/editline] Shit that's a huge video
That's awesome! So you're using the game engine to lay out tiles, which you can save and then mess with further/add enemies to/etc in Unity proper?
[QUOTE=Maloof?;47136343]That's awesome! So you're using the game engine to lay out tiles, which you can save and then mess with further/add enemies to/etc in Unity proper?[/QUOTE] The game has an inline level editor so I can edit the level tiles & entities while I play. I decided to run with this idea because the nature of platformers sometimes requires very precise placement and timing to create a higher difficulty but maintain the ability to actually win. I also put together my own level format which stores the information in a binary file.
[QUOTE=foszor;47136415]The game has an inline level editor so I can edit the level tiles & entities while I play. I decided to run with this idea because the nature of platformers sometimes requires very precise placement and timing to create a higher difficulty but maintain the ability to actually win. I also put together my own level format which stores the information in a binary file.[/QUOTE] Gotcha. It sounds pretty inense, but it also sounds like something I can work on alongside my general physics, puzzles, etc, until I'm experienced enough to implement something similar in full.
[t]http://i.imgur.com/L1p68ZT.png[/t] Multiplayer with interpolation!
Can anyone give me some ideas on my game? I'm having idea block and need some help to get out of it. [IMG]http://cloud-4.steamusercontent.com/ugc/532885201667834136/169B90EA3CF4564D33990A77940FC0867FBCEE7A/[/IMG] I've got a steam concepts for it, and I can answer any questions that aren't answered on there. [url]http://steamcommunity.com/sharedfiles/filedetails/?id=391224221&searchtext=[/url]
Sorry, you need to Log In to post a reply to this thread.