i was moving decent the other day but now i have that compiler thing happening and i couldnt figure it out at all where the source issue is from. i thought i was taking my time but something went wrong. Im very used to coding for M.U.G.E.N and pin pointing and spotting errors to fix fast with creating Stages and characters but this is tricky.
I tried looking up the answer here before posting but no luck navigating to it. I would appeciate it majorly if someone could help me figure this out or if there is a clear and decent Youtube video on it
When you get the console message telling you that there are compiler errors, it’s actually telling you exactly where the problem is. Expand the console (if you had it minimized) and look through all the message text. At some point you’ll see something like this:
That means the problem is in the file YourScript.cs, at or around line 14. Sometimes it’s on the previous line because it wasn’t terminated correctly. The error message there will tell you what’s wrong and steer you towards how to fix it.
In any case, you have to provide that kind of information here for us to be able to actually help you. It’s also important to share the code for the file mentioned (all of it) and to do so using code tags so we don’t pass out from trying to read a mess of unreadable text.
Ok i truly appreciate this. Thank you. ill remember that definitely next time with posting the code too. I didnt think that was important because i really didnt do anything there yet so i was confused at the time honestly. I usually post code errors in the MUGEN forums i create for that way also. Im familiar with that. But yeah im still a baby at navigating and spotting errors on Unity properly haha.
Im starting clean again. no biggie since im only at start up stance and move. Ill ask again here if the error comes up. ill share the code i have too.
edit:
I Started back at the base. im just using some sprites i found for testing before i go for my original stuff. if the error pops up again ill share the code. The character is moving in the stance. the next step i was trying to do was set it up to walk forwards with the walking sprites i have. Thats when the compiler issue happened again
OK i just got that compiler issue again because im trying make a script for that character 2Dcontroller
using UnityEngine;
public class Character2DController : MonoBehaviour
{
Public float MovementSpeed = .1;
Private void Start()
{
}
Private void Update()
{
Var movement = input.GetAxis("Horizontal");
transform.position += new Vector3(movement, 0, 0) * Time.deltaTime * MovementSpeed
}
}
thats the code below again i just followed on Youtube the guy was showing to move a character back and forth. every time i try to do a code like this i get that compiler issue and i dont understand it yet. Is it color sensitive as well? i took a pic of my code with the colors that show when i type this stuff in.
Color is added by the IDE you’re using, so no, that doesn’t matter. What does matter is capitalization, though, and I can see a few mistakes there. (“Private” vs “private”, “Var”, “input”, etc).
Check all your capitalizations and see if that fixes your problem.
Ok heres my code i went with this time and below it is what happened to fix the problem
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Move2D : MonoBehaviour {
public float MoveSpeed = 5f;
// use this for initialization
void Start() {
}
// Update is called once per frame
void Update () {
Vector3 movement = new Vector3(Input.GetAxis("Horizontal"), 0f, 0f);
transform.position += movement * Time.deltaTime * MoveSpeed;
}
}
OK as you can see i went with a different tutorial video because i wasnt getting anywhere. so i tried this Guy code above and the compiler issue happened again… so im confused again… so i sat there and just looked at everything. first thing that came to mind was “Color” why are these words generating blue etc etc. so then i looked to the left and the screw driver icon was there. clicked it and it referenced fix options it seemed. so when i did that it generated “public float” in blue. when i did it it was regular. so i used the MoveSpeed = 5f;
expression with it and then it made my character move again when i pressed play. so my question is. is that screw driver fixer and “color” important when using Unity?