You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type MySpace struct { goworld.Space // Space type should always inherit from entity.Space }
i create a space called mySpace, if i use func GetSpace(id common.EntityID) *Space
i will get an *Space and i can not change it into mySpace unless use mySpace := (*MySpace)(unsafe.Pointer(space))
and if i change GetSpace into func GetSpace(id EntityID) entity.ISpace { return entity.GetSpaceI(id) }
then we can easily cast ISpace into mySpace
ms := goworld.GetSpaceI(monster.Space.ID).(*MySpace)``
The text was updated successfully, but these errors were encountered:
here is the seene
type MySpace struct { goworld.Space // Space type should always inherit from entity.Space }
i create a space called mySpace, if i use
func GetSpace(id common.EntityID) *Space
i will get an *Space and i can not change it into mySpace unless use
mySpace := (*MySpace)(unsafe.Pointer(space))
and if i change GetSpace into
func GetSpace(id EntityID) entity.ISpace { return entity.GetSpaceI(id) }
then we can easily cast ISpace into mySpace
ms := goworld.GetSpaceI(monster.Space.ID)
.(*MySpace)``The text was updated successfully, but these errors were encountered: