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