How to exit leval in unreal engine from visual studio - c#

How can I stop simulation in Unreal Engine from Visual Studio.
Taking this function:
UFUNCTION(BlueprintCallable, Category = "Character Movement")
static void AddAcceleration(UCharacterMovementComponent* MovementComponent, FVector WishDirection, float MaxSpeed, float Acceleration, float ConstantAcceleration, float DeltaTime);
When I call this function from blueprint and forget to provide Movement Component and click on play level. Then unreal takes me to Visual Studio showing nullptr error and unreal editor window becomes non-responsive, now how to stop game simulation from Visual Studio.
I could close the engine, but then all my unsaved progress is lost.

Related

Unity NavMeshAgents snap to outskirts of NavMeshSurface during runtime

I'm having some interesting behaviour with NavMeshAgents. So I've been working on a project for the past few months which is revolving around creating believable enemy AI systems for stealth games. When the player kills an enemy they can pickup the body and put it into a body bag, this all worked well and fine for a while but now once the player has picked up two corpses all Nav Agents do this.
They are still in their patrol state (using a behaviour tree) and all of the AI have a destination set which can be seen on the debug tools for the Agent. However if I try to move the AI whether that being dragging them around or setting a position through the inspector they will snap back to a corner of the NavMeshSurface.
Using Unity 2021.1.17f1 and using the latest compatible version of the NavMeshComponents package provided by Unity.
Things I've tried:
Changing Radius and Height of agents
Setting the floor and such as navigation static objects
Removing the NavMeshComponents package scripts and replacing them with the original NavMesh system. Didn't work and took a lot longer to build the NavMesh
Interesting behaviour:
The amount of body bags the player has to pick up seems to be related to how many AI are in the scene. For example currently there are 23 AI and it takes two body bags for this glitch to happen, but if there are 24 to 31 AI in the scene then it requires three body bags to be picked up for it to happen.
All calls to the NavMeshAgent are done through a AILocomotion script which handles enabling and disabling rotation, movement and updating the animation. Movement is only disabled upon death or when the AI is in the wait state, other than that every Move based state re-eneables movement.
Update: Found the solution
It turns out Unity does not like it when you destroy a NavMeshAgent component during runtime. Now when the player picks up a corpse it leaves the NavAgent behind but destroys the mesh and colliders etc.

Unity animation is too fast when exporting from Blender

I'm trying to export the tree animation I made in Blender with the Sapling Tree Gen plugin to Unity. In Blender everything is normal, but when I play the animation in Unity it's too fast. I already tried locking the Unity framerate to 30, but it doesn't change. Is there a way to slow down the animation?
Yes,
first make sure you have made an animator component for your object(tree), then create an animator controller in your assets folder and open it, then add the default animation from your imported object to your animation controller (it should be in your assets folder) and at last, by clicking on your default animation in animator controller you have access to speed and other properties related to your object.

Creating simple sprites in Visual Studio 2019

Im realatively new to programming, I want to make a fairly simple game in visual studio for a school project; At this stage I need to create a simple sprite of a ship which can rotate and move in the direction it's facing, I already made a movement engine but I am stuck at making the sprite itself. What is the simplest method of making the sprite, preferably without the use of third party software.
Thanks in advance
Actually, I've never tried to program a game in visual studio and I don't have an answer to that But Instead, I have an easier suggestion which is to learn the basics of unity game engine which shouldn't take more than 3 hours or so but the possibilities unity will give is much better than visual studio's because unity is specialized in games while visual studio is specialized in programs, so if your game is as simple as you are describing then I would highly recommend that you give unity a try, and btw unity uses c# as it's programming language so you shouldn't find any difficulties with the programming side.
cheers !

How to detect BLE beacons on Unity3D HoloLens app?

I have built an app in Unity3D which should be able to detect Bluetooth Low-Energy beacons on the Microsoft HoloLens. Here is the Unity C# script code that I used to get this done.
using UnityEngine;
using Windows.Devices.Bluetooth.Advertisement;
public class BeaconDetector : MonoBehaviour
{
private BluetoothLEAdvertisementWatcher _watcher;
void Start()
{
_watcher = new BluetoothLEAdvertisementWatcher();
_watcher.Received += WatcherOnReceived;
_watcher.Start();
}
//This method should be called when a beacon is detected
void WatcherOnReceived(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs args)
{
//Just a simple check if this method is even called
Debug.Log("Beacon detected!");
}
}
The app builds and runs on the HoloLens nicely, but (even after waiting a couple of minutes) I do not get the desired output line in my debug log. This means to me that the WatcherOnReceived() method is never called, which ultimately means that no beacon is detected.
I use some Sensoro SmartBeacon-4AA's which can transmit both iBeacon and Eddystone signals.
I have been trying this for a couple of weeks right now, did several tutorials along the way but I still can not figure out why this is not working for me.
It was a permission problem after all. It is possible to solve this issue in both Unity (pre-build) and Visual Studio (post-build). Here are both solutions:
Solution A: in Unity
Head to Edit > Project Settings > Player.
In the Inspector, open up the tab Publishing Settings.
Under the Capabilities section, make sure that Bluetooth is enabled.
Click on the .gif to expand
Solution B: in Visual Studio (2017)
In your Solution Explorer (Ctrl+Alt+L), expand your project.
Double-click the Package.appxmanifest.
Go to the Capabilities tab.
Again, make sure that Bluetooth is enabled.
Click on the .gif to expand
This will give your app the right to use Bluetooth on the HoloLens.

Unity camera not properly turning

Im working on my first project in unity and I am running into a problem where the camera is not turning properly, i cannot look up or down only left and right and even then it does not turn the camera but the angle of the environment here are some screenshots of the setup of the project.[

Categories