About Create a Simple Class and Add Object

Hello, I’m coming from C # and having some difficulty in finding the right format to write classes

I’m trying to create a class to enter the scene with my property …

I’m trying to create an object of class SpotLight Example

ASpotLight xlight;

returned is more time talking about the construction of the object error …

Does anyone have any file running some modification on some object for me to understand how it works?

Thank you!

There are on the order of thousands of files with examples of this included in the source code. Coming from C# you may want to hit google and look around, but without a concrete example of what you are trying to do you are likely to spin your wheels, and us along with you.

I would like to create a Point Light in a script and add it on the screen when I open the Class Viewer window and put the script in the game .

I start by creating a class of type Pawn and Editor opens me to my class in visual studio …

Right now I have not much idea of how to proceed …

By the editor I can open the file PointLight.h

— X —

/ / Copyright 1998-2014 Epic Games , Inc. All Rights Reserved .

pragma once

include " PointLight.generated.h "

UCLASS ( HeaderGroup = Light , classgroup = ( Lights , PointLights ) , MinimalAPI , target = ( ChildCanTick ) )
APointLight class : public alight
{
GENERATED_UCLASS_BODY ()

UPROPERTY ( BlueprintReadOnly , Category = " Light " , target = ( ExposeFunctionCategories = " PointLight , Rendering | Lighting " ) )

  • PointLightComponent UPointLightComponent class ;

/ / BEGIN DEPRECATED (use component functions now in level script )
UFUNCTION ( BlueprintCallable , Category = " Rendering | Lighting " , target = ( DeprecatedFunction ) )
ENGINE_API SetRadius void (float NewRadius ) ;
UFUNCTION ( BlueprintCallable , Category = " Rendering | Lighting " , target = ( DeprecatedFunction ) )
ENGINE_API SetLightFalloffExponent void (float NewLightFalloffExponent ) ;
/ / END DEPRECATED

if WITH_EDITOR

/ / Begin AActor interface.
virtual void EditorApplyScale ( const FVector DeltaScale & , const FVector PivotLocation * , bool bAltDown , bShiftDown bool , bool bCtrlDown ) OVERRIDE ;
/ / End AActor interface.

endif

/ / Begin UObject interface.
virtual void PostLoad ( ) OVERRIDE ;

if WITH_EDITOR

virtual void LoadedFromAnotherClass ( const FName & OldClassName ) OVERRIDE ;

endif

/ / End UObject interface.
} ;

— X —

Now how do I create an object of that type in my class with a property that changed the way I want ?

Hmm…

Are you asking how to create an instance of a point light for your actor?

If so, maybe Rama’s answer here will get you moving in the right direction.
Are you comfortable with writing your own C++ code at this point in your career?

Brow,

  • Is this instance of objects that I would like to create …

But I’m still having some difficulty to build from the beginning … I’m also looking at the Wiki to see if I can find some example … If something appears easy ai sends me which helps a lot …

Regarding the C + + I have no choice, I need to learn how to do …

Thank you!