Comments (2)
OK, I have other news.
Since the problem started i tried everything to study the problem and maybe fix it, now I realized that simply is not working:
public class Foots : MonoBehaviour
{
[TypeReferences.Inherits(typeof(MonoBehaviour), AllowAbstract = false, ExcludeNone = true, IncludeBaseType = false)]
[SerializeField]
protected MonoBehaviour MyType = null;
}
Same problem same error message:
NullReferenceException: Object reference not set to an instance of an object
TypeReferences.Editor.Util.SerializedTypeReference.get_GuidAssignmentFailed () (at Library/PackageCache/[email protected]/Editor/Util/SerializedTypeReference.cs:41)
TypeReferences.Editor.Util.SerializedTypeReference.SetGuidIfAssignmentFailed () (at Library/PackageCache/[email protected]/Editor/Util/SerializedTypeReference.cs:66)
TypeReferences.Editor.Util.SerializedTypeReference..ctor (UnityEditor.SerializedProperty typeReferenceProperty) (at Library/PackageCache/[email protected]/Editor/Util/SerializedTypeReference.cs:23)
...
Instead using it inside a scriptable object has no problem:
using UnityEngine;
namespace ScriptableConfigs.Weapons
{
[CreateAssetMenu(fileName = "Weapons", menuName = "MyWeapon")]
public class Settings_Weapons : ScriptableObject
{
[TypeReferences.Inherits(typeof(WPN_BaseModule), AllowAbstract = false, ExcludeNone = true, IncludeBaseType = false)]
[SerializeField]
public TypeReference WeaponType = null;
}
I installed via OpenUPM like described here: https://github.com/SolidAlloy/ClassTypeReference-for-Unity#install-with-openupm
What I'm doing wrong?
Again, thank you in advice
from classtypereference-for-unity.
My apologies,
I realized that the property type is wrong, i need to use TypeReferences.TypeReference
🤦♂️.
I'm closing this issue.
from classtypereference-for-unity.
Related Issues (20)
- The type 'MonoScript' is defined in an assembly that is not referenced. HOT 1
- TypeReference dropdown does not respect [Inherits] Attribute constraints HOT 8
- The following workaround seems to work:
- DLL conflicts with Cysharp packages HOT 2
- Unsupported type TypeReference HOT 2
- NullReferenceException HOT 2
- Dropdown goes to top left of screen on unity version 2021.1.21f HOT 8
- NullReferenceException when adding asset via GenericUnityObjects HOT 2
- System.Memory.dll present in Unity 2021.2.0f1 HOT 5
- README still references old package name com.solidalloy.type.references HOT 3
- UIElements Or Checking When Value Has Changed HOT 2
- Cant import sample HOT 1
- ExcludeNone feature bronen in latest release HOT 1
- Cannot install due to to invalid dependencies HOT 1
- GUID conflict HOT 1
- TargetFramework issue with other packages HOT 1
- Freezing Issues Inside VisualElement Container HOT 2
- The attribute 'Short Name' doesn't work when you search the drop down. HOT 1
- Unity 2022.3.4f1 NullReferenceException: Object reference not set to an instance of an object HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from classtypereference-for-unity.