using NetworkLobbyManager with dynamic NetworkStartPositions - unity3d

Having some trouble getting the NetworkLobbyManager to honor my NetworkStartPositions. This stems from the fact I generate my board dynamically when the game scene is loaded in my GameManager object.
I tried disabling auto spawn in the NetworkLobbyManager but it prevents LobbyPlayers from spawning too.
I would move my GameManager or NetworkStartPosition Spawner up into the Lobby scene but that doesn't seem like the right answer.
Here's where I am in my project: https://github.com/jakecoffman/tanks-unity/tree/f397b8b4e494461b94c718f1997d7572e5c6821f
Any suggestions? Any other tips on my project are welcome too.

I found someone else's project on Github that overrides OnLobbyServerSceneLoadedForPlayer and sets the position of the game player. Still not sure how to use NetworkStartPosition, but this is simple enough!

Related

Facing AI Seek Behavior issue in Unity

I am currently self-learning steering behaviors and am following this lecture I had found which gives a really good introduction about AI implementation aka https://edirlei.com/aulas/game-ai-2020/GAME_AI_Lecture_07_Steering_Behaviours_2020.html.
I've faced an issue when trying to implement the 'Seek' behavior in a 2D game environment in which the 'seek' game object does not try to move towards its target. There are no errors showing in the console but my best guess is that it's because of the use of Rigidbody in the 'SteeringBehaviorBase' class code. I've tried converting it to Rigidbody2D instead but sadly it still does not move.
For further context, I've attached the 'SteeringBehaviorBase' and 'SeekBehavior' classes onto my 'seek' game object and a circle collider on my 'seek target' game object. I've also set the reference of the seek target property in the 'SeekBehavior' code to the 'seek target' game object.
I would really appreciate anyone's help in guiding me to solve this problem.

Why do my 2D objects not collide in Unity despite that the layers are set correctly?

I have a platform that I need to flip the direction of when it collides with an object. The platform as well as its child objects belong to the layer "FlyingOrPlatform". The object that the platform collides with should belong to the "GameControl" layer. But if i set it to that it doesnt collide with it.
If I set the object that the platform collides with to either the "Player" or "Default" layer. Then it works completely as it should. But I wish to use the "GameControl" layer.
I have tried where I save the scene and the project, as well as restarting the editor.
I dont see what should be wrong with my layer setup. Any suggestions?
In my script for reversing the platform direction there is no layer check, it does check the tag but I ensured that the tag is the same when I switch between the layers. I just use Unity's built in OnTriggerEnter2D lifecycle method. Have tested with OnCollisionEnter2D and OnTriggerStay2D as well, same result.
Here is a link to a video demonstrating the issue, as well as a screenshot of my physics2D settings below. In the video I first show how its supposed to work, and then I switch the object the platform collides with to the GameControl layer, after which it doesnt work.
Video of issue: https://www.youtube.com/watch?v=l-eqYI-K-Ug
Physics2D settings:
From what I can tell this appears to be an issue with the Physics2D matrix in Unity that occurs from time to time. A couple of other people have written similar things on other forums.
Among others this reply had a similar issue:
For lack of better, I found a work-around by using the "Ignore Raycast" layer instead of the "GameControl" layer.
I have reported it as a bug to Unity.
EDIT:
Here is the reply I got from Unity.
"Hi,
We successfully reproduced this issue. It will be possible to follow
the progress on a chosen resolution in our public Issue Tracker once
the report has been processed (this might take up to an hour):
https://issuetracker.unity3d.com/product/unity/issues/guid/1325018
We highly appreciate your contribution. If you have further questions,
please feel free to contact us."

Gameobject sprite missing at runtime when animator is enabled

I've identified a problem with one of my 2d platform gameobjects with a animator component attached to it.
The platforms sprite goes missing at runtime and this is directly caused by the animator itself, which before wasn't a problem. when I disable the animator and run the game the sprite doesn't go "missing", but as soon as I enable it, it's missing again.
This is probably happening because I started the project in unity 2019b and switched to 2018.4.12 because I was getting weird CURL errors that prevented me from building for Android. The affected prefab(platform) functions as it should other then the fact that the sprite goes missing at runtime and nothing about the project has changed. Code works perfectly as it did when there were no issues.
I just installed unity 2019.2.13 hoping this would solve it but no change. Tried re-importing the asset but nothing. This isn't a collision issue. The 'z' axis is not modified at runtime. and its definitely not a code issue because as stated before the functionality isn't affected, its just the sprite going missing. I'm out of ideas now and exhausted online resources. Can anyone help in any way. Thanks in advance.
simple fix. i just created a new prefab and re-created the animations... Annoying but it worked

Unity3d Nav Mesh Agent avoiding newly created objects

I'm creating a randomly generated terrain game where an enemy will follow after you. The terrain is built after launch through UnityScript. I am using Nav Mesh Agent for the enemies path finding but it is unable to find its way around the newly created objects. Is there a way to update the Nav Mesh after launch to accommodate the new objects? Thanks in advance!
Aside from plugging someone else's asset store product, have you looked at the NavMeshObstacle component? It's intended for dynamic obstacles for avoidance with NavMeshAgents.
And no, you cannot (nor should need to) rebuild the NavMesh at runtime.
As far as I know you cannot rebuild navmesh.
Maybe you should try with Astar pathfinding project http://arongranberg.com/astar/. It's great and used in a lot of commercial games. Free version has option to rebuild navigation graphs.
For next questions about unity3d try here.

Unity: Third Person Collision with Animated Platforms

first time posting on stack and everything looks promising so far! I had a bit of a complicated question here so I'll do my best to provide exact details of what I'd like to get accomplished. I'm working with a third person controller in unity, so far everything is going great. I've dabbled with basic up and down platforms, a little glitchy but things work. Anytime my player runs through a mesh I make sure the mesh collider is working and a 'rigid-body' is attached set to Kinematic. Here's the kicker, in my game I have turning gears which the player can jump on. This is great except for the player doesn't turn with my gear, which would make sense according to my game-play. What would be the process for getting my character to interact with this animated mesh? I imagine some sort of script which my nooby mind cannot fathom at this point in my unity career. If anyone out there knows the solution to this, I would love to have any assistance, either way I'll plugging away at a solution. Thanks again!!
This is assuming that you're using the packages that ship with Unity3D, which it sounds like you are. After importing the Character Controllers package, you'll have a bunch of scripts in the Standard Assets\Character Controllers\Sources\Scripts folder, in the project hierarchy view. There's a script in there called CharacterMotor.js, attach that to the same GameObject you're running ThirdPersonController on.
Essentially this script adds more interactivity between the character and the scene. There's several methods inside this script that automatically move the character when in contact with a moving object (as long as it has a collision mesh) basically by inheriting the object's velocity.
If your gear/cog wheel has a proper collision mesh set up, adding this script to your character should be all that you require.