Hello,
It’s my first question on this forum so sorry if it doesn’t follow the usual conventions.
I try to create a new package with Unity (SmartGamingLibrary) for one of my project and use it in an another project (called TestPackage) but can’t succeed to use it properly in my script.
I have a project called SmartGamingLibrary who follow the naming convention for a Unity Package.
There is below the architecture of the folder of the project and the Configuration class I try to use.
The content of package.json of my package SmartGamingLibrary
{
"name": "com.smartgamingframework.smartgaminglibrary",
"displayName": "Smart Gaming Library",
"version": "0.0.1",
"unity": "2020.3",
"description": "A reusable library for creating game for smart device.",
"author": {
"name": "Vincent SORIN",
"email": "vince.sorin@gmail.com.com"
}
}
The content of Configuration.cs file
using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
namespace SmartGamingLibrary.Utility
{
public class Configuration
{
// some code
}
}
When i create a new project called TestPackage and try to use my package previously created i have some trouble with the error message
Assets/Test.cs(2,7): error CS0246: The type or namespace name ‘SmartGamingLibrary’ could not be found (are you missing a using directive or an assembly reference?)
- I have added successfully the package in the package manager view
- I see my package in the projects views in the unity explorer
- I also add a package.json to the root of my project to handle dependancies with my custom package
{
"name": "MyUnityProject",
"displayName": "My Unity Project",
"version": "1.0.0",
"dependencies": {
"com.smartgamingframework.smartgaminglibrary": "0.0.1"
}
}
And the code where i try to use the Configuration object from my custom package with the using instruction
using UnityEngine;
using SmartGamingLibrary.Utility;
public class Test : MonoBehaviour
{
void Start()
{
Configuration config = new Configuration();
Debug.Log("Configuration class loaded!");
}
}
Sorry for the big message but if anyone had an idea on how to solve that, it will be really helpful.
Do not hesitate to ask more informations or picture if needed.
Thanks