Blax4
Sudan Çıkmış
- Mesajlar
- 3
- En iyi cevaplar
- 0
- Beğeniler
- 0
- Puanları
- 50
using UnityEngine;
using System.Collections;
public class karakter : MonoBehaviour {
//use this for initialization
public float hiz ;
public float h ;
public float ziplama_gucu;
Rigidbody2D fizik_karakter;
void start () {
fizik_karakter = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update(){
if (Input.GetKeyDown(KeyCode.Space))
{
fizik_karakter.velocity += new Vector2(0,ziplama_gucu);
}
}
void FixedUpdate()
{
h = Input.GetAxis("Horizontal");
transform.position += new Vector3(h*hiz*Time.deltaTime,0,0);
}
}
şöyle bi script yazdım unity de 2d oyun yapabilmek için ama zıplamada şöyle bi hata veriyr
NullReferenceException: Object reference not set to an instance of an object
karakter.Update () (at Assets/New Folder/New Folder/karakter.cs:18)
ne yapmam lzm
using System.Collections;
public class karakter : MonoBehaviour {
//use this for initialization
public float hiz ;
public float h ;
public float ziplama_gucu;
Rigidbody2D fizik_karakter;
void start () {
fizik_karakter = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update(){
if (Input.GetKeyDown(KeyCode.Space))
{
fizik_karakter.velocity += new Vector2(0,ziplama_gucu);
}
}
void FixedUpdate()
{
h = Input.GetAxis("Horizontal");
transform.position += new Vector3(h*hiz*Time.deltaTime,0,0);
}
}
şöyle bi script yazdım unity de 2d oyun yapabilmek için ama zıplamada şöyle bi hata veriyr
NullReferenceException: Object reference not set to an instance of an object
karakter.Update () (at Assets/New Folder/New Folder/karakter.cs:18)
ne yapmam lzm