From 7581e1325afe7a5bb8a55150a029da8942817d25 Mon Sep 17 00:00:00 2001 From: Deficuet Date: Fri, 5 Jan 2024 21:46:39 -0700 Subject: [PATCH] update GameObject --- .../unitykt/internal/impl/GameObjectFields.java | 14 ++++++++------ .../github/deficuet/unitykt/classes/GameObject.kt | 13 +++++++------ .../unitykt/internal/impl/GameObjectImpl.kt | 12 ++++++------ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/main/java/io/github/deficuet/unitykt/internal/impl/GameObjectFields.java b/src/main/java/io/github/deficuet/unitykt/internal/impl/GameObjectFields.java index eeb3d954..fa73b22c 100644 --- a/src/main/java/io/github/deficuet/unitykt/internal/impl/GameObjectFields.java +++ b/src/main/java/io/github/deficuet/unitykt/internal/impl/GameObjectFields.java @@ -6,6 +6,7 @@ import kotlin.UInt; import kotlin.UShort; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; abstract class GameObjectFields extends EditorExtensionImpl { GameObjectFields(@NotNull SerializedFile assetFile, @NotNull ObjectInfo info) { @@ -17,10 +18,11 @@ abstract class GameObjectFields extends EditorExtensionImpl { String fmName; UShort fmTag; Boolean fmIsActive; - Transform fmTransform; - MeshRenderer fmMeshRenderer; - MeshFilter fmMeshFilter; - SkinnedMeshRenderer fmSkinnedMeshRenderer; - Animator fmAnimator; - Animation fmAnimation; + + @Nullable Transform fmTransform = null; + @Nullable MeshRenderer fmMeshRenderer = null; + @Nullable MeshFilter fmMeshFilter = null; + @Nullable SkinnedMeshRenderer fmSkinnedMeshRenderer = null; + @Nullable Animator fmAnimator = null; + @Nullable Animation fmAnimation = null; } diff --git a/src/main/kotlin/io/github/deficuet/unitykt/classes/GameObject.kt b/src/main/kotlin/io/github/deficuet/unitykt/classes/GameObject.kt index fa03fff0..4098bf0e 100644 --- a/src/main/kotlin/io/github/deficuet/unitykt/classes/GameObject.kt +++ b/src/main/kotlin/io/github/deficuet/unitykt/classes/GameObject.kt @@ -6,10 +6,11 @@ interface GameObject: EditorExtension { val mName: String val mTag: UShort val mIsActive: Boolean - val mTransform: Transform - val mMeshRenderer: MeshRenderer - val mMeshFilter: MeshFilter - val mSkinnedMeshRenderer: SkinnedMeshRenderer - val mAnimator: Animator - val mAnimation: Animation + + val mTransform: Transform? + val mMeshRenderer: MeshRenderer? + val mMeshFilter: MeshFilter? + val mSkinnedMeshRenderer: SkinnedMeshRenderer? + val mAnimator: Animator? + val mAnimation: Animation? } \ No newline at end of file diff --git a/src/main/kotlin/io/github/deficuet/unitykt/internal/impl/GameObjectImpl.kt b/src/main/kotlin/io/github/deficuet/unitykt/internal/impl/GameObjectImpl.kt index 6c50cb6f..d59abeb5 100644 --- a/src/main/kotlin/io/github/deficuet/unitykt/internal/impl/GameObjectImpl.kt +++ b/src/main/kotlin/io/github/deficuet/unitykt/internal/impl/GameObjectImpl.kt @@ -29,27 +29,27 @@ internal class GameObjectImpl( checkInitialize() return fmIsActive } - override val mTransform: Transform get() { + override val mTransform: Transform? get() { checkInitialize() return fmTransform } - override val mMeshRenderer: MeshRenderer get() { + override val mMeshRenderer: MeshRenderer? get() { checkInitialize() return fmMeshRenderer } - override val mMeshFilter: MeshFilter get() { + override val mMeshFilter: MeshFilter? get() { checkInitialize() return fmMeshFilter } - override val mSkinnedMeshRenderer: SkinnedMeshRenderer get() { + override val mSkinnedMeshRenderer: SkinnedMeshRenderer? get() { checkInitialize() return fmSkinnedMeshRenderer } - override val mAnimator: Animator get() { + override val mAnimator: Animator? get() { checkInitialize() return fmAnimator } - override val mAnimation: Animation get() { + override val mAnimation: Animation? get() { checkInitialize() return fmAnimation }