Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Question error CS1729: 'lootAngle' does not contain a constructor that takes 0 arguments

Discussion in 'Scripting' started by kevinmaster686, Mar 31, 2023.

  1. kevinmaster686


    Mar 31, 2023
    hola no se si hablen español pero necesito ayuda con este codigo

    public class SpawnerSample : MonoBehaviour
    public GameObject ObjectToSpawn;
    void Start()
    lootAngle mylootAngle = new lootAngle();

    void SpawnPotion(int angle)
    int radius = 5;

    Vector3 direction = Quaternion.Euler(0, angle, 0) * Vector3.right;
    Vector3 spawnPosition = transform.position + direction * radius;
    Instantiate(ObjectToSpawn, spawnPosition, Quaternion.identity);
  2. Kurt-Dekker


    Mar 16, 2013
    The complete error message contains everything you need to know to fix the error yourself.

    The important parts of the error message are:

    - the description of the error itself (google this; you are NEVER the first one!)
    - the file it occurred in (critical!)
    - the line number and character position (the two numbers in parentheses)
    - also possibly useful is the stack trace (all the lines of text in the lower console window)

    Always start with the FIRST error in the console window, as sometimes that error causes or compounds some or all of the subsequent errors. Often the error will be immediately prior to the indicated line, so make sure to check there as well.

    Look in the documentation. Every API you attempt to use is probably documented somewhere. Are you using it correctly? Are you spelling it correctly?

    All of that information is in the actual error message and you must pay attention to it. Learn how to identify it instantly so you don't have to stop your progress and fiddle around with the forum.

    Remember: NOBODY here memorizes error codes. That's not a thing. The error code is absolutely the least useful part of the error. It serves no purpose at all. Forget the error code. Put it out of your mind.

    How to report your problem productively in the Unity3D forums:

    This is the bare minimum of information to report:

    - what you want
    - what you tried
    - what you expected to happen
    - what actually happened, especially any errors you see
    - links to documentation you used to cross-check your work (CRITICAL!!!)

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

    How to use code tags: