- Home /
Question by
Max_dragotoba · Apr 13 at 10:49 PM ·
codepage
why wont my code effect the game
I have my code here and even when I comment out the whole thing and save the outcome won't change. I've checked in the assets and it shows the newest version that I created but when I run the code the same thing happens as normal. To add on when I add a new variable the inspecter does not change.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class bean_2_bot2 : MonoBehaviour
{
public static float countb = 1;
public int stop = 0;
public int stop2 = 0;
public int no_more = 0;
public int not_many = 0;
public int enter = 0;
public int enter2 = 0;
// Start is called before the first frame update
public string forward = "forward";
// Start is called before the first frame update
void Start()
{
/*public Transform object;
var bean1 = GameObject.Find("BEAN 1");
var pos1 = bean1.transform.position;
var bean2 = GameObject.Find("BEAN 2");
public var pos = bean2.transform.position;*/
}
public void stop_edit()
{
enter += 1;
if (no_more > 0)
{
//Move(forward, 5);
stop += 1;
}
Move(forward, no_more);
no_more +=1;
}
void Move(string direction, int amount)
{
//public static Vector3 positionen;
if (direction == "forward")
{
transform.position += Vector3.right * amount;
}
if (direction == "jump")
{
//transform.position += Vector3.up * 1;
//float nice = 5.0f;
//float jump = Input.GetAxis("Jump");
//Rigidbody rigidBody;
//rigidBody = GetComponent<Rigidbody>();
//float jumpMovement = rigidBody.velocity.y;
//transform.position += Vector3.up * 1.5f / 10f;
//countb = 1;
if (countb > 0)
{
transform.position += Vector3.up * (1.5f / (countb * 2f + 3f));
countb += 0.5f;
if (countb == 75)
{
countb = 0;
}
}
}
}
// Update is called once per frame
public void Update()
{
//not_many += 1;
//Move(forward, stop);
//if (true)//bean_2_health.health_S_2 > Score.health_S && //stop %2 == 0 && //not_many >=10
//{
Move("forward", 1);
not_many = 0;
//}
stop2 = stop;
}
}
Comment
Have you attached your script to a game object?
Add Debug.Log("something happening?")
inside the Start() function (line 20 or so) and check console when playing: it should print that statement.
I don't see any code that would make any variable change. The stop_edit is not called anywhere.
Good luck.
Your answer
