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. Dismiss Notice

error CS0246

Discussion in 'Scripting' started by XDKalabaZo, Aug 31, 2020.

Thread Status:
Not open for further replies.
  1. XDKalabaZo

    XDKalabaZo

    Joined:
    Aug 25, 2020
    Posts:
    14
    Hello I get this error and I can't find how to fix it

    Assets\Scripts\LvLGestor.cs(11,9): error CS0246: The type or namespace name 'Int' could not be found (are you missing a using directive or an assembly reference?)


    my code:

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

    public class LvLGestor : MonoBehaviour
    {
    public void CargarSiguienteNivel()
    {
    Int ecenaActualIndice = SceneManager.GetActiveScene().buildIndex;
    Int SiguienteEcenaIndice = ecenaActualIndice + 1;
    SceneManager.LoadScene(SiguienteEcenaIndice);
    }
    }
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,722
    C# uses lowercase
    int
    not
    Int
     
  3. XDKalabaZo

    XDKalabaZo

    Joined:
    Aug 25, 2020
    Posts:
    14
    [QUOTE = "PraetorBlue, publicación: 6263460, miembro: 166058"] C # usa
     int [/ ICODE] en minúsculas y no [ICODE] Int [/ ICODE] [/ QUOTE]
    thanks
     
  4. unity_jjhtpWoQZZx2Hw

    unity_jjhtpWoQZZx2Hw

    Joined:
    Oct 30, 2020
    Posts:
    9
    Hi folks,

    I've the same error in my project (its name is Mikacraft), the following message in the console is displayed to me:
    Assets/Scripts/Inventory/Inventory.cs(7,12): error CS0246: The type or namespace 'ItemDatabase' couldn't be found (are you missing a using directive or an assembly reference?).

    What I've made wrong here? Here's my C# source code:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class Inventory : MonoBehaviour {
    6.  
    7.     public ItemDatabase database;
    8.  
    9.     int slotAmount = 9;
    10.     int storageAmount = 36;
    11.  
    12.     public GameObject slot;
    13.     public GameObject hotbarPanel;
    14.     public GameObject inventoryPanel;
    15.  
    16.     // Start is called before the first frame update
    17.     void Start() {
    18.         database = gameObject.GetComponent<ItemDatabase>();
    19.     }
    20.  
    21.     // Update is called once per frame
    22.     void Update() {
    23.      
    24.     }
    25. }
    26.  
    And here's an image of the error:
    Bildschirmfoto 2020-12-20 um 08.31.52.png
    It would be really nice, if you can help me to point out this error. Thanks!

    Sincerely yours,
    Atten007
     
    Last edited: Dec 20, 2020
  5. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,722
    Do you have a class in your project called ItemDatabase?
     
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,762
    Please don't hijack old threads. Start your own... it's FREE!

    How to report your problem productively in the Unity3D forums:

    http://plbm.com/?p=220
     
Thread Status:
Not open for further replies.