roboryantron / unite2017 Goto Github PK
View Code? Open in Web Editor NEWSample project for Game Architecture with Scriptable Objects from Unite Austin 2017
License: MIT License
Sample project for Game Architecture with Scriptable Objects from Unite Austin 2017
License: MIT License
Hi! Great talk, i wanted to push your ideas to our team, but found something dirty (type mismatch)
Why is it happening? I just opened project and launched demo
I think the reason for that is referencing scene objects from asset, as it can't save them.
And if it would be actual type mismatch - i would get error when adding to the list :c
So is it fine? Can i ignore it and draw names of the scene obejcts in custom editor for that EnabledThings for example?
Hi!
I've been trying to implement a EventManager system with scriptableObjects following your system.
Using GameEventListener and GameEvents.
https://drive.google.com/open?id=10qbMMY9oPzcCfW6nZLAHugA6Q7ToXotX
https://drive.google.com/open?id=1LDdapYIDncnNL4M0TEmoaFqsWv2mUMeo
https://drive.google.com/open?id=140IufZd1ppF-rP8JUmnZ9uYXQb1PYfWr
On the editor it works perfectly, but when I build it in Android it doesnt work. It is as if the scriptableObjects weren't assigned, or are just null.
Also, debugging it in android I get warnings like:
I tested it building the sample project in android an it worked there, so could it be a problem with my Unity set up?
The implementation is for an VRDaydream game. Any ideas?
Could you please add a license file to the repository so people can tell under what terms the code can be used? The MIT license would be a nice choice, if possible. Thanks!
Hi,
I really like the idea of using scriptable objects as variables. Adding a description is really usefull, specially in bigger projects.
Unite2017/Assets/Code/Variables/FloatVariable.cs
Lines 15 to 18 in 6912f2f
Unfortunatly, it seems that this is not possible anymore to keep the description as an editor definition in Unity 2019.1. It generates a crash at runtime with the following message :
Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
I'm not sure when this broke but it currently does not work in Unity 2019.3.14.
property.FindPropertyRelative();
always returns null
. I have FloatReference
defined in my project and I also created an instance saved in my project.
Here's the problematic line:
You mention briefly in the question section of your talk that there is code in your framework to revert these values to their original state. You mention that the PlayerHealth gets "reset to the default value on Start". If you mean that the SimpleHealth script literally sets PlayerHealth.value = MaxHealth.value in Start, that means the PlayerHealth asset would remain modified when you stop running your game.
You would end up with potentially tens or hundreds of scriptable assets being modified (depending on the scale of your project), and you'd have to discard these changes every time in your source control before committing your work. That sounds like a nightmare!
Im really interested in this workflow, hence all the questions. Looking forward to your replies :)
Hey there, great talk..I'll be posting some questions and this is the first one.
A lot of your examples seem to fall apart when we start looking at "real world" examples where you would have multiple enemies, players, etc.
Let's look at your example with player prefab that has a Simple health component that reference the PlayerHealth asset. The UI would be wired up to look at this one health asset. What if I wanted to make a split screen game? Multiple player's? Seems like there would be a need to have to constantly instantiate new copies of these persistent scriptable assets so every player gets their own one. This would mean, if I wanted to display a health bar above players heads, I would have to (through code, at runtime), manually set the PlayerHealth reference on the Healthbar script to that players PlayerHealth variable.
player2Healthbar.SetHealthReference(player2Instance.PlayerHealth)
This goes against keeping everything modular but I can't see a way around it.
A better example might be enenies with Healthbar above their heads. They all need their own instance of EnemyHealth and all the Healthbars would need to be pointed at the correct EnemyHealth instance at runtime.
Hello Ryan! I'm probably very late but amazing sharing; it completely changed the way on how I worked with Unity and this is so beneficial. Thank you!
I am thinking of adding a set
to the Value
property so that when other scripts assign a value, the Value
property can receive it, then modify, based on whether UseConstant
is true
or false
, ConstantValue
or Variable.Value
.
The property will look like this:
public float Value
{
get { return UseConstant ? ConstantValue : Variable.Value; }
set
{
if (UseConstant)
ConstantValue = value;
else
Variable.Value = value;
}
}
And in other scripts, one can simply do something like this:
public FloatReference hp;
.
.
.
hp.Value = 10;
So far, the only implication I have seen was that setting via a FloatReference
, you may be expecting a variable to get updated, but if UseConstant
is true
, the constant is updated and not the variable. So, for example, if you decrement the player's HP and the HP is of type FloatReference
with UseConstant
set to true
, then this may not update the UI for the HP (e.g. say a HP bar) which depends on a FloatVariable
to determine the fill amount, making others think that the player's HP is not decreasing.
But then if such a case happens, FloatVariable
should be used to adjust HP instead of FloatReference
, which will make it clear to the team that modifications made to it will be clearly shown.
Hi Ryan,
I am very happy to see new ScriptableObjects stuff. There are limited source when its come to architecture in unity. In your presentation demo I saw inventory in project root. Sadly, you had not enough time to show on unite event. I would like to see what you were to present about inventory.
Thank you
Hi, this system is exactly what I need.
Still learning how to use it.
Is there a way to send data with that event being raised? (e.g. send the gameobject or object name from which the event was raised)
Maybe your inventory example would've shed some light on this. How does data remain persistant? (IE player Inventory)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.