- Home /
Object disappears once played
I've modeled something in Blender, converted it into an fbx file, and put it in Unity. I see it in the Scene View, Game View, and the Camera preview. However, when I play the game, everything disappears. There is no animation component, and I did not use the component "skinned mesh renderer". I changed the project into WebGL already, since I know I will use that. I tried restarting and and reimporting but nothing worked. Any help would be appreciated :D
Edit: I realized this is because a script that I wrote. The script name is "followPlayer" and this is all the code inside:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class followPlayer : MonoBehaviour
{
public Transform player;
private void Update()
{
transform.position = new Vector3(transform.position.x, transform.position.y, player.position.z + 12.5f);
}
}
Answer by Galse22 · Aug 27, 2020 at 01:57 PM
Try entering play mode, then pause the game. See if it is there.
It's still there in the scene view, but that's very clever!
Actually, pausing the game made me see that in my script there was a typo. I put a plus sign instead of a $$anonymous$$us sign.
Great! Sorry I'm answering late, I did not get a notification.
Your answer
Follow this Question
Related Questions
What is Matrix4x4? 2 Answers
How do i code a Mesh collider ? 1 Answer
Faux Gravity help 0 Answers
I want to rotate an object towards mouse position on screen in 3d environment. How can I do this? 4 Answers