Search Unity

Need Help on what ios wrong with my Csharp Code

Discussion in 'Scripting' started by jakedavis160, Feb 9, 2019.

  1. jakedavis160

    jakedavis160

    Joined:
    Feb 9, 2019
    Posts:
    1
    Assets/Tiled2Unity/Scripts/Editor/ImportTiled2Unity.Prefab.cs(97,27): warning CS0618: `UnityEditor.PrefabUtility.ReplacePrefab(UnityEngine.GameObject, UnityEngine.Object, UnityEditor.ReplacePrefabOptions)' is obsolete: `Use SaveAsPrefabAsset or SaveAsPrefabAssetAndConnect with a path instead.'



    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class PlayerMovement : MonoBehaviour
    {
    Rigidbody2D rbody;
    Animator Anim;
    // Start is called before the first frame update
    void Start()
    {
    rbody = GetComponent<Rigidbody2D> ();
    Anim = GetComponent<Animator> ();
    }
    // Update is called once per frame
    void Update() {
    Vector2 movement_vector2 = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
    if (movement_vector2 != Vector2.zero)
    {
    Anim.SetBool("iswalking", true);
    Anim.SetFloat("input_X", movement_vector2.x);
    Anim.SetFloat("input_Y", movement_vector2.y);
    } else {
    Anim.SetBool ("iswalking", false);
    }
    rbody.MovePosition(rbody.position + movement_vector2 * Time.deltaTime);
    }
    }