UCLASS(abstract, config=Game, BlueprintType, hidecategories=("Pawn|Character|InternalEvents"))
class ENGINE_API ACharacter : public APawn
{
GENERATED_UCLASS_BODY()
...
UPROPERTY(Transient)
uint32 bClientWasFalling:1;
/** If server disagrees with root motion track position, client has to resimulate root motion from last AckedMove. */
UPROPERTY(Transient)
uint32 bClientResimulateRootMotion:1;
/** Disable simulated gravity (set when character encroaches geometry on client, to keep him from falling through floors) */
UPROPERTY()
uint32 bSimGravityDisabled:1;
/**
* Jump key Held Time.
* This is the time that the player has held the jump key, in seconds.
*/
UPROPERTY(Transient, BlueprintReadOnly, VisibleInstanceOnly, Category=Character)
float JumpKeyHoldTime;
上面的代碼來自UE4。他們似乎使用uint32一位bitfields而不是bools。他們爲什麼這樣做?爲什麼我應該使用1bit位域而不是bools?
我想象它是爲了節省空間。 – shuttle87 2014-10-20 16:11:40
'bool'不使用一位,所以如果他們打包超過4個變量,他們會獲得一些空間。 – Jarod42 2014-10-20 16:12:10
UE4是一款現代化的發動機。在現代系統中節省內存是至關重要的嗎? – 2014-10-20 16:17:19