#Editor instancing of uobjects

1 messages · Page 1 of 1 (latest)

sturdy radish
#

using the Instanced property on a UObject, with it being set to EditInlineNew, makes it instantiate in-editor

#

as an example with my quest structure;

#

SqsQuest is UObjects

#

with nested UObjects for Objectives and Fail Conditions

#

If this is not what you're asking for, then I misunderstood you 😛

#

@ruby swift in case you weren't notified about the thread (first time I'm starting one so got no clue about what happens)

#
UPROPERTY(EditAnywhere, Instanced)
MyUObject* Item;

// Class propeprties
UCLASS(Blueprintable, EditInlineNew)
ruby swift
#

Thanks for the answer but im actually looking for the opposite.
I need to have one asset that i can reference from other objects, without creating a new instance of it.

Same usage case of a data asset. If i have 10 objects that use the same data asset, i wouldn't want to have 10 instances of the same data asset, but only one instance that is referenced by the 10 objects

I was just curious about how to do it without relying on a data asset

sturdy radish
#

Picking a data asset inside the instanced uobject would only create a light uobject for the instance, with a pointer to that 1 data asset

#

In other words, all instances of uobject that has the same itemID(dataAssetID) would point to the very same singleton DataAsset

#

Alternative would prob be some runtime subsystem with singletons ..

ruby swift
#

Im sorry i feel like i'm not explaining my question correctly

My objective is to have two classes:

The first one is the ItemStack class, and has properties like a pointer to a Item class, Count, and other data.
Item stacks are what inventories will handle and what the player is gonna be able to equip and use.

The second class is the Item class, which contains only code and no data.
At all times there should be one and only one instance of each item class

So for example i can have a RangeWeaponItem class which is based on Item class, and implements basic functionality for all ranged weapons. Then have CrossbowItem which is based on RangeWeaponItem, and modifies the functionality.

I can have multiple stacks of crossbows (item stacks with pointer to instance of CrossbowItem), but there will only ever be a single instance of the CrossbowItem class

Right now the way im doing it is to have the Item class be a DataAsset, but the problem is that it does not offer the possibility to implement functionality in blueprint (which i might care about in the future)

So i want to be able to have a UObject class that i can use as a singleton, and that i can select in the detail panel of other classes (like you can do with data assets but not uobjects)

#

Thanks again for the help btw

sturdy radish
#

Let DataAsset point to the actual uobject class that holds the logic. Then have a manager(subsystem?) create that uobject at runtime?

#

So DataItem has some Logic class pointer that implements the use logic for that item

#

Whenever a player use the item, they push the itemID to the subsystem, which handles the functionality in context of the player who triggered it ?

#

Something along those lines... is what id be thinking

ruby swift
#

Ok so i guess i will need to look into subsystems