How to create a a gameobjective that is only visible in scene view, not game - unity3d

I would like to create a bunch of gameobjects to be used as spawn points and path finding targets, I’d like these to be visible on the scene view, even while the game is running, but not visible in the game. Seems like this should be a thing, but I’m failing to find it.
I’ve tried googling this, but all I find are people that are experiencing this behavior, but it undesired.

If you just want to see them, you can use OnDrawGizmos.
Inside this MonoBehaviour function, you can use Gizmos.DrawSphere(position, radius) to draw a sphere that can only appear in scene view. You just need to use the position of your GameObject as the position argument and you can draw as many spheres as you want. There are other shapes as well, see what fits your needs better.
Read the documentation for an example. Make sure to have your Gizmos activated in the scene mode, otherwise it doesn't appear.

Related

How can I stop my NavMesh from baking inside static game objects?

In my scene I have 2 cubes with navigation static checked in the inspector and the navmesh has been baked.
https://i.stack.imgur.com/e9qXQ.png
You can see in this screenshot how when I put the camera inside the top cube, the navmesh has been baked underneath it, even though the cubes are perfectly aligned. I'm trying to avoid putting a navigation block under every static in the scene that has walkable areas above it. Is it not possible to have navmeshed surfaces that exclude the area underneath if it is unreachable?
Thanks.
I am pretty sure that if you do not have any links between the NavMeshArea you can just leave it like that, as the NavMeshAgents respect the area they are spawn/move to. But if you really want to get rid of it see below.
One thing you could do, is to add a NavMeshObstacle to the object and resize it, so that it fits the top area you want to get rid of. This would remove the area inside the cube.
Note that this is a workaround, as there is very likely another and better solution to the problem, but this solves the issue you are having very quickly.

Unity2d: Why does this sprite act like it is behind the background even though its Z-value is set to be in front of the canvas?

Showing the general setup of the scene and where the sprite is
the sprite is "behind" the background but the Z-value should be correct
I have tried solutions such as changing the render mode of the canvas; the different options do not work and "World Space" turns the game view into the default background color. I could not figure this out after a day of reading up manuals/guides and looking at other questions. Thank you for helping me!
The issue is you are trying to use a SpriteRenderer on a Canvas object. Remove the SpriteRenderer and either use an Image or RawImage component instead.
Another note regarding UI that you will inevitably run into is unless specified otherwise, objects further down in a Canvas hierarchy will render on top of those above it.
I would also avoid changing the z-axis on all of your objects. Make Canvas groups that have different sorting layers to render groups on top of one another. Place objects in a specific order in the hierarchy to get the draw order you desire. Messing with the z-axis in a 2D scene can be a headache down the line and is not very modular. If you want to change sort order later, the specific z offset you set to each object will need to change.

Textures to Object in Unity / Vuforia

I'm trying to do some Augmented Reality in Unity using the Vuforia plugin. I've managed to get everything working (I'm using a 3d model of a car), only the position of the car relative to the marker is wrong when I come to preview it (click the 'Play button at the top and watch through the computer's camera - is 'preview' the right name for this?).
It should be sitting on the the marker in the center, but instead it's floating above the marker and off to the side by quite a bit. The positioning is definitely right in the program itself, so I'm not sure why this isn't reflected in the preview.
Also: at the moment the car is simply an untextured grey object. I realise the textures are included in a subfolder, however I can't drag the entire car's folder (including the Textures subfolder) into the ImageTarget, only the .3ds file itself. Does anyone know how to apply the original textures to the car?
Thanks so much for your help in advance!
Ben
Well, to start answering your question about the drifting away part, you've probably got a Rigidbody attached to your Car? Well, if that's the case, then Go to the Inspector where the Rigidbody is and you'll see constraints.
To avoid it floating off, you might want to check Freeze Positions for whichever direction it needs. Probably Y axis.
Now, I'm not entirely sure if you're using Vector.AddForce to move your objects, but if you are then just check if your car can move if you've put all constraints on.
If you can't then in your code trying using Object.Rigidbody.SetActive(true) when you need it to start moving, and Object.Rigidbody.SetActive(false) when its done.
On the other hand, if you aren't using Vector.AddForce() then remove Rigidbody component if you've used it.
As for the material. If you've got the material in your folder that you've downloaded then just drag and drop it into Assets. Now sometimes your car may be one solid mesh, but some times it may be multiple meshes. So which ever the case. Drag the material from your Assets onto the Hierarchy panel over your car mesh/meshes and it should turn into that color.
Hope it helps. :)

Scrolling Scene Background - Unity

My title might have actually been a bit misworded, as to be honest I'm not sure how to word it, but basically I'm making a game on Unity and I have my main scene and I am making a main menu however what I want to do is have a, I guess, camera slowly panning around the main scene as the background of the main menu. Not sure if I worded that right or what wording to actually type into Google to research it so I'm hoping you guys might be able to point me in the right direction.
Cheers guys,
Jason
As stromdotcom mentioned you can attach a script to the camera.
It's hard to tell what you're trying to do but if you want to circle the camera around a point...
Try making an empty game object in the middle of your scene and point the camera at it.
Make the object the parent of the camera (using the object and cameras transform properties).
From here you should be able to set the game object to rotate using a script, which should make the camera spin as it is a child of the object.
I have not tried this in Unity but I have used this technique in other programs so I'm assuming it will work. Sorry if it doesn't.
If your scene is already set up then you can attach a script to your camera which simply modifies the camera's transform to move it around the room. You can move and rotate the camera just like any other transform in your scene.
Im pretty sure what you are looking for is "Animation view". Unity has a tutorial on it: https://unity3d.com/learn/tutorials/topics/animation/animation-view?playlist=17099

How to display a part of a scene in another scene (Scene Kit + Swift)

First, I just want to introduce to you guys my problem, because it is really complex so you need this to understand it properly.
I am trying to do something with Scene Kit and Swift : I want to reproduce what we can see in the TV Show Doctor Who where the Doctor's spaceship is bigger on the inside, as you can see in this video.
Of course the Scene Kit Framework doesn't support those kind of unreal dimensions so we need to do some sort of hackery to do achieve that.
Now let's talk about my idea in plain english
In fact, what we want to do is to display two completely different dimensions at the same place ; so I was thinking to :
A first dimension for the inside of the spaceship.
A second dimension for the outside of the spaceship.
Now, let's say that you are outside of the ship, you would be in the outside dimension, and in this outside dimension, my goal would be to display a portion of the inside dimension at the level of the door to give this effect where the camera is outside but where we can clearly see that the inside is bigger :
We would use an equivalent principle from the inside.
Now let's talk about the game logic :
I think that a good way to represent these dimensions would be two use two scenes.
We will call outsideScene the scene for the outside, and insideScene the scene for the inside.
So if we take again the picture, this would give this at the scene level :
To make it look realistic, the view of the inside needs to follow the movements of the outside camera, that's why I think that all the properties of these two cameras will be identical :
On the left is the outsideScene and on the right, the insideScene. I represent the camera field of view in orange.
If the outsideScene camera moves right, the insideScene camera will do exactly the same thing, if the outsideScene camera rotates, the insideScene camera will rotate in the same way... you get the principle.
So, my question is the following : what can I use to mask a certain portion of a certain scene (in this case the yellow zone in the outsideView) with what the camera of another view (the insideView) "sees" ?
First, I thought that I could simply get an NSImage from the insideScene and then put it as the texture of a surface in the outsideScene, but the problem would be that Scene Kit would compute it's perspective, lighting etc... so It would just look like we was displaying something on a screen and that's not what I want.
there is no super easy way to achieve this in SceneKit.
If your "inside scene" is static and can be baked into a cube map texture you can use shader modifiers and a technique called interior mapping (you can easily find examples on the web).
If you need a live, interactive "inside scene" you can use the sane technique but will have to render your scene in a texture first (or renderer your inside scene and outer scene one after the other with stencils). This can be done by leveraging SCNTechnique (new in Yosemite and iOS 8). On older versions you will have to write some OpenGL code in SCNSceneRenderer delegate methods.
I don't know if it's 'difficult'. As we have to in iOS , a lot of times the simplest answer ..is the simplest answer.
Maybe consider this:
Map a texture onto a cylinder sector prescribed by the geometry of the Tardis cube shape. Make sure the cylinder radius is equal of the focal point of the camera. Make sure you track the camera to the focal point.
The texture will be distorted because it is a cylinder making onto a cube. The actors' nodes in the Tardis will react properly to the camera but there should be two groups of light sources...One set for the Tardis and one outside the Tardis.