Unity Cullinggroup OnStatechanged nicht schießenC#

Ein Treffpunkt für C#-Programmierer
Anonymous
 Unity Cullinggroup OnStatechanged nicht schießen

Post by Anonymous »

Ich habe kürzlich von der Cullinggroup erfahren, aber ich kann es nicht zum Laufen bringen. Code < /p>
private readonly List experienceList = new();
private CullingGroup cullingGroup;
private BoundingSphere[] boundingSpheres;
[SerializeField] private float cullingRadius = 30f;

private void Start() { SetupCullingGroup(); }
private void Update() { UpdateBoundingSpheres(); }

private void SetupCullingGroup()
{
cullingGroup = new CullingGroup();
cullingGroup.SetDistanceReferencePoint(this.transform);
cullingGroup.SetBoundingDistances(new float[] { cullingRadius });

boundingSpheres = new BoundingSphere[poolSize];
for (int i = 0; i < poolSize; i++) boundingSpheres = new BoundingSphere(experienceList.transform.position, 10f);

cullingGroup.SetBoundingSpheres(boundingSpheres);
cullingGroup.SetBoundingSphereCount(poolSize);
cullingGroup.onStateChanged += OnCullingStateChanged;
}

private void UpdateBoundingSpheres()
{
for (int i = 0; i < boundingSpheres.Length; i++) {
boundingSpheres.position = experienceList.transform.position;
Debug.Log(cullingGroup.GetDistance(i));
}
}

public void OnCullingStateChanged(CullingGroupEvent state)
{
Debug.Log("cullingStage changed"); //TODO this is never being called
}
< /code>
Konsole ein paar Frames nach Beginn des Spiels (die '0' ist Cullinggroup. Was fehlt mir? /> Spieler und Erfahrung sind in verschiedenen Schichten.>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post