i have many error please help me

i have 2 errors:

Assets\RagdollDeath.cs(8,6): error CS0246: The type or namespace name ‘SerializedFieldAttribute’ could not be found (are you missing a using directive or an assembly reference?)

Assets\RagdollDeath.cs(8,6): error CS0246: The type or namespace name ‘SerializedField’ could not be found (are you missing a using directive or an assembly reference?)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RagdollDeath : MonoBehaviour
{
    [Header("References")]
    [SerializedField] private Animator animator = null;

    private Rigidbody[] ragdollBodies;
    private Collider[] ragdollColloders;

    private void Start()
    {
        ragdollBodies = GetComponentsInChildren<Rigidbody>();
        ragdollColliders = GetComponentsInChildren<Collider>();

        ToggleRagdoll(False);

        Invoke(nameof(Die), 5f);
    }

    private void Die()
    {
        ToggleRagdoll(true);

        foreach(Rigidbody rb in ragdollBodies)
        {
            rb.AddExplosionForce(107f, new Vector3(-1f, 0.5f, -1f), 5f, 0f, ForceMode.Impulse);
        }
    }

    private void ToggleRagdoll(bool state)
    {
        animator.enabled = !state;

        foreach(Rigidbody rb in ragdollBodies)
        {
            rb.isKinematic = !state;
        }

        foreach (Collider collider in ragdollColliders)
        {
            collider.enabled = state;
        }
    }


}

[code]

[SerializedField] should be [SerializeField]

i fixed it and i got 6 new errors and something else the last 2 lines:

Assets\animationStateController.cs(37,14): error CS0103: The name ‘isrunning’ does not exist in the current context

Assets\animationStateController.cs(42,13): error CS0103: The name ‘isrunning’ does not exist in the current context

Assets\RagdollDeath.cs(16,9): error CS0103: The name ‘ragdollColliders’ does not exist in the current context

Assets\RagdollDeath.cs(18,23): error CS0103: The name ‘False’ does not exist in the current context

Assets\RagdollDeath.cs(42,39): error CS0103: The name ‘ragdollColliders’ does not exist in the current context

Assets\scripts\controller\Movement.cs(52,12): error CS0103: The name ‘collisionn’ does not exist in the current context

Assets\Nokobot\Modern Guns - Handgun_Demo Assets\SimpleShoot.cs(16,40): warning CS0649: Field ‘SimpleShoot.casingExitLocation’ is never assigned to, and will always have its default value null

Those error messages are telling you what’s wrong. For example, this one:

tells you there is no such identifier as “ragdollColliders” in your class or method. You probably think there is, because (most likely) you meant to type “ragdollColliders” when you typed this line:

private Collider[ ] ragdollColloders;

See the difference?

Same with “False.” You probably meant “false.”

A lot of us are happy to help, but you need to put your own effort in as well. Look at the error messages and check your typing.

i will i am just new to unity and c sharp, i fixed most of the errors except for 1:

Assets\animationStateController.cs(42,13): error CS0149: Method name expected

You’ll have to post the code for animationStateController. (Note: it is very common practice to give your classes names that start with a capital letter, like “AnimationStateController.”)

here is the code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class animationStateController : MonoBehaviour
{
    Animator animator;
    int isWalkingHash;
    int isRunningHash;

    // Start is called before the first frame update
    void Start()
    {
        animator = GetComponent<Animator>();
        isWalkingHash = Animator.StringToHash("isWalking");
        isRunningHash = Animator.StringToHash("isRunning");
    }

    // Update is called once per frame
    void Update()
    {
        bool isRunning = animator.GetBool(isRunningHash);
        bool isWalking = animator.GetBool(isWalkingHash);
        bool forwardPressed = Input.GetKey("w");
        bool runPressed = Input.GetKey("left shift");

        if (!isWalking && forwardPressed)
        {
            animator.SetBool(isWalkingHash, true);
        }

        if (isWalking && !forwardPressed)
        {
            animator.SetBool(isWalkingHash, false);
        }

        if (!isRunning && (forwardPressed && runPressed))
        {
            animator.SetBool(isRunningHash, true);
        }

        if (isRunning(!forwardPressed || !runPressed))
        {
            animator.SetBool(isRunningHash, false);
        }
    }
}

[code]

now the thing is i cant see what is wrong in the code, i went to the spot it says the error is at but i dont see anything wrong

In this line:

if (!isRunning && (forwardPressed && runPressed))

you are using isRunning as a boolean variable.

The problem is in this line:

if (isRunning(!forwardPressed || !runPressed))

What is different in that line about how you are using isRunning? You are getting a good clue in the error message, “Method name expected.”

i fixed it thank so much

Me it’s about this script.

// Cinema Suite
using UnityEngine;

namespace CinemaDirector
{
///


/// Event that captures a screenshot when triggered.
///

[CutsceneItem(“Utility”, “Storyboard”, CutsceneItemGenre.GlobalItem)]
public class StoryboardEvent : CinemaGlobalEvent
{
public string FolderName = “Storyboard”;
public static int Count = 0; // Count how many screenshots have been captured.

///


/// Capture screenshot on trigger.
///

public override void Trigger()
{
ScreenCapture.CaptureScreenshot(string.Format(@“Assets{0}{1}.png”, this.gameObject.name, Count++));
}
}
}

But Assets/Cinema Suite/Cinema Director/Cutscene Items/Global Items/Utility/StoryboardEvent.cs(20,13): error CS0103: The name `ScreenCapture’ does not exist in the current context.

What should Do I?

What should do I?

6841049–796184–StoryboardEvent.cs (716 Bytes)

You should not hijack someones old thread, and instead start your own thread.

1 Like

As The Godlike Bob pointed out, hijacking threads is against forum rules.

Make your own thread. It’s free. When you do, here is how to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

How to understand errors in general:

https://forum.unity.com/threads/assets-mouselook-cs-29-62-error-cs1003-syntax-error-expected.1039702/#post-6730855

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: https://discussions.unity.com/t/481379

1 Like