#Draggable child class

1 messages ยท Page 1 of 1 (latest)

pulsar willow
#

Continue in this thread if theres more

south karma
#

i might've just worded it wrong

#

the idea was to have my own kind of MonoBehaviour style script thats just for writing out the cinematic events in c#

#

SO doesn't seem to fit that function

#

good for setting up like stats and other simple behaviors that only need parameters but i'm trying to make a simplified event builder essentially thas all

#

for the actors i have to have a predefined dictionary with an ID and game object reference on an actual monobehaviour

#

probably could just do something like that

#

for the "custom scripts"

pulsar willow
#

So the events could be unique? I can see why SO doesn't work then (at least like this). You could make the SO's sub assets and have unique data on them but sounds like a hassle

south karma
#

well, the cinematic action is already basically part of the workflow

pulsar willow
#

Anyway the first thing I recommended (using SerializeReference) should work here

south karma
pulsar willow
#

SerializeReference allows you to serialize child classes derived from an abstract class or interface

south karma
#

oh lemme try that

pulsar willow
south karma
#

ok ill bookmark that for now. i think an ID table is good enough for the application for now but i'll go back over this for future expansion

#

appreciate the link

#

oh hey

#

dropping the field type to UnityEngine.object allowed it

#

would i be able to recast it to my class type? (i'll find out in a minute but save me that much time?)

#

interesting

pulsar willow
#

Is Script a MonoScript? As I mentioned earlier, that doesnt work at runtime.

south karma
#

doesn't like casting back to CinematicScript

pulsar willow
#

Things dont work this way

south karma
#

but is there a runtime emit here?

pulsar willow
#

MonoScript isn't an object with functionality

south karma
#

or some way to runtime compile code?

pulsar willow
#

There might be some frameworks for that, but why?

#

Do you want people to be able to code at runtime?

south karma
#

its more for advanced event sequencing

#

yeah idk about this. emitting is usually not a great idea anyway

#

meh

pulsar willow
#

Idk why you need to do any emitting/reflection here if the class always already exists at editor time anyway

south karma
#

yeah this is all way more convoluted than it needs to be. oh well

#

easier to just drop monos into an ID table on a scene director object and run those by key

#

thanks for the insight either way ๐Ÿ‘

pulsar willow
#

If not, then sure

south karma