The inspector does not show the slot of the class I declared

Hello, I am having a problem with the inspector not showing the slots for the classes I have declared.

I am having trouble seeing the class slots in the inspector.

First, I create three classes “GameManager, AllManager, and Test”.
The contents of the classes are as follows.

Since this is for verification purposes, the contents of each are meaningless, but we expect that the following statement will add references to all three classes, including confidence, in all three classes.

 public gameManager: GameManager = null!
 public allManager: AllManager = null!
 public test: Test = null!

The following is the result of attaching these three classes to the appropriate nodes and checking them in the inspector.

GameManager shows a slot for Test.
Test shows nothing.
AllManager shows the slots of GameManager and Test.

As you can see, the only difference between the three classes is their names.
But why are the slots displayed differently?

The version of Cocos Creator is 3.8.2.

It seems have circular reference. I think is better to declare a parent class for these classes,and then

import { _decorator, Component, Node } from 'cc';
import { BaseManager } from './BaseManager';
const { ccclass, property } = _decorator;

export class GameManager extends BaseManager {
    public gameMgr: BaseManager;

    public allMgr: BaseManager;

    public testMgr: BaseManager;

Thank you for your answer.
circular reference?
What is wrong with my code?

The script I created this time is a confirmation process, so there is no problem to delete this.
However, the reason I created this confirmation script was because the slots were not showing up in the Manager class that generates the UI prefabs when needed.

What should I take care of and create a Manager class that generates the prefab?

Simply, circular reference is like class A depends on class B, class B depends on class A.It vary easy to cause problems in any language. In ts, for example:

In file “A.ts” you import class B from file “B.ts”, But In file “B.ts” you import Class A. In this time Class A may not ready, I’m not clear how the compiler handles this situation, But I know it’s easy to make errors, sometimes it will sometimes not in my experience in ts. In c++ it even cant pass compilation.

I’m not quite sure what "generates the UI prefabs " mean. Anyway, avoid circular reference. Its a coding problem not cocos problem.

My apologies.
The UI analogy was not appropriate.

What I fear is that slots may or may not display on a whim.

For example, I would write the following code to refer to a prefab named Test to which I have a Test class attached.

public test: Test = null!

This looks perfectly fine, as there is no error.
However, it cannot be used because the slot is not displayed.

If you change the code to the following, the slot will be displayed.

public test: Prefab = null!

However, this does not tell us the identity of test, so we must do getComponent to use the functionality of the Test class, and there is no guarantee that the test class is attached to this prefab.

Also, the use of getComponent causes me the following problem

Yes, in Unity the following process shows the slot without any problem.

public test: Test = null!

However, there is no explanation for this issue on the difference with unity page.

Sorry my English is not vary good. I am not quite understand what you’re saying. Can you give me a demo?
By the way, In public test: Prefab = null!, what is “!” use for, in ts , It seems meaningless.

No, I am sorry.
It is my responsibility to translate Japanese into English.

What I want to know is how to display a slot to attach to the inspector.
There is little explanation of this in the documentation, and the slots are not showing up, even though certain conditions are not causing errors.

For example, “circular reference” problem .

Therefore, I would like to know how to display the slots and how not to display the slots.

Is this what you’re looking for?

Yes. We are looking here.
But I do not have the information I am looking for.

For example, it does not say that the following statement is required to prepare a prefabricated slot.

public test: Prefab = null!

I found this from the UI demo.

It seems first appear in quick start.

I think in decorator part, It has been explained very clearly. if we want to bind some value to object with editor. First we should declare it in component. Then fill the value or drag the object to the slot. Its vary natural. One thing need to note is in ```@propery(Type)````, the Type need to be cc class.

Thank you very much.

One thing need to note is in ```@propery(Type)````, the Type need to be cc class
This is very useful information